ADD: Выпадающее меню в админ-панель

This commit is contained in:
Evg 2022-03-09 07:15:59 +03:00
parent 8ce1dcdf87
commit f3f9c2d1a8
11 changed files with 70 additions and 77 deletions

View file

@ -264,7 +264,7 @@ function tabs_nav($name, $item, $user, array $pages = [])
foreach ($pages as $key => $page) {
$tl = $page['tl'] ?? 0;
if (!empty($page['hr'])) {
if ($user['id'] > 0) $html .= '<li><hr class="w-90"></li>';
if ($user['id'] > 0) $html .= '<li><div class="m15"></div></li>';
} else {
if ($trust_level >= $tl) {
$isActive = $page['id'] == $item ? ' aria-current="page" class="active" ' : '';

View file

@ -1,5 +1,5 @@
<?php
Request::getHead()->addStyles('/assets/css/style.css?14');
Request::getHead()->addStyles('/assets/css/style.css?18');
?>
<?= Tpl::insert('meta', ['meta' => $meta]); ?>
@ -9,6 +9,11 @@ Request::getHead()->addStyles('/assets/css/style.css?14');
<header class="d-header sticky top0">
<div class="wrap">
<div class="d-header_contents">
<div class="none mb-block">
<div class="menu__button mr10">
<i class="bi bi-list gray-400 text-xl"></i>
</div>
</div>
<div class="flex items-center w200">
<a href="<?= getUrlByName('admin'); ?>">
<span class="black"><?= Translate::get('admin'); ?></span>
@ -27,9 +32,9 @@ Request::getHead()->addStyles('/assets/css/style.css?14');
<div class="m15 gray-400 mb-none">
<?= Request::getRemoteAddress(); ?>
</div>
<a class="ml5 sky-500" href="/">
<i class="bi bi-house"></i>
</a>
<a class="ml5 sky-500" href="/">
<i class="bi bi-house"></i>
</a>
</div>
</div>
</header>

View file

@ -75,7 +75,7 @@
<h3 class="uppercase-box"><?= Translate::get('posts'); ?> (no facet)</h3>
<?php foreach ($data['posts_no_topic'] as $post) { ?>
<div class="gray">
id:<?= $post['post_id']; ?> | <?= $post['post_title']; ?>
id:<?= $post['post_id']; ?> | <?= $post['post_title']; ?>
</div>
<?php } ?>
</div>
@ -86,7 +86,7 @@
<?php foreach ($data['logs'] as $log) { ?>
<div class="gray">
<?= $log['request']; ?> <sup class="gray-400"><?= $log['count_results']; ?></sup>
<span class="gray-400 lowercase">
<span class="gray-400 lowercase">
(<?= Translate::get($log['action_type']); ?>) <?= lang_date($log['add_date']); ?>
</span>
</div>

View file

@ -1,15 +1,13 @@
<?= includeTemplate('/view/default/header', ['meta' => $meta]); ?>
<div class="col-span-2 mb-none">
<ul class="menu">
<?= tabs_nav(
'menu',
$data['type'],
1,
$pages = Config::get('admin/menu.admin')
); ?>
</ul>
<div class="menu__left col-span-2">
<ul class="menu">
<?= tabs_nav(
'menu',
$data['type'],
1,
$pages = Config::get('admin/menu.admin')
); ?>
</ul>
</div>
<main class="col-span-10 mb-col-12 ">

View file

@ -1,6 +1,6 @@
<?php
Request::getHead()->addStyles('/assets/css/style.css?16');
Request::getHead()->addStyles('/assets/css/catalog.css?v16');
Request::getHead()->addStyles('/assets/css/style.css?18');
Request::getHead()->addStyles('/assets/css/catalog.css?v18');
?>
<?= Tpl::insert('meta', ['meta' => $meta]); ?>

File diff suppressed because one or more lines are too long

View file

@ -316,8 +316,8 @@ document.querySelectorAll(".item_cleek")
}));
/*
* Drop-down menus and lists
* Выпадающие меню и списки
* Drop-down menus (user) and lists
* Выпадающие меню (user) и списки
*/
let elm = document.querySelectorAll(".trigger");
elm.forEach(function(elm) {
@ -359,12 +359,19 @@ elm.forEach(function(elm) {
});
});
document.querySelectorAll(".menu-left")
.forEach(el => el.addEventListener("click", function (e) {
document.querySelector('body').classList.add('boxUser');
}));
document.querySelectorAll(".closebtn")
.forEach(el => el.addEventListener("click", function (e) {
document.querySelector('body').classList.remove('boxUser');
}));
/*
* Left drop-down general menu (navigation)
* Левое выпадающее общее меню (навигация)
*/
const button = document.querySelector('.menu__button')
const nav = document.querySelector('.menu__left')
button.addEventListener('click', () => {
nav.classList.toggle('menu__active')
})
window.addEventListener('click', e => {
const target = e.target
if (!target.closest('.menu__active') && !target.closest('.menu__button')) {
nav.classList.remove('menu__active')
}
})

View file

@ -1,5 +1,4 @@
<div class="col-span-2 menu-user">
<div class="closebtn">x</div>
<div class="menu__left col-span-2">
<nav class="sticky top-sm">
<ul class="menu">
<?= tabs_nav(

View file

@ -16,7 +16,6 @@
.dropdown a i,
.menu a i {
color: var(--gray-400);
margin-right: 10px;
font-size: 1.5rem;
}
@ -30,7 +29,7 @@
box-shadow: 0 12px 12px rgba(0,0,0,0.15);
padding: 5px 10px 5px 10px;
z-index: 5;
min-width: 160px;
min-width: 180px;
}
.dropdown.left {
@ -54,10 +53,7 @@
color: var(--gray-600);
}
.nav a i {
color: var(--gray-400);
margin-right: 4px;
}
.nav a i { margin-right: 4px; }
.active,
a.active,
@ -79,49 +75,37 @@ a.active > i,
}
/* Left mobile menu */
.menu-user .closebtn { display: none; }
.boxUser .menu-user .closebtn {
color: #333;
float: right;
margin-right: 15px;
font-size: 21px;
display: block;
}
.boxUser .menu-user .menu {margin-top: 25px;}
.boxUser main {
margin-left: 145px;
transition: 0.25s;
}
.boxUser .menu-user {
opacity: 1;
visibility: visible;
transition: 0.25s;
}
.boxUser nav.top-sm { top: 0; }
.menu-none {
opacity: 0;
position: absolute;
}
@media (max-width: 980px) {
.menu-user {
.menu__button { transition: 0.3s ease; }
.menu__left {
opacity: 0;
position: absolute;
}
.menu__left.menu__active {
opacity: 1;
visibility: visible;
transition: 0.25s;
}
.menu__left {
opacity: 0;
visibility: hidden;
transition-property: opacity, visibility;
transition: 0.25s;
z-index: 98;
left: 0;
top: 0;
width: 143px;
background-color: #fff;
bottom: 0;
min-width: 180px;
max-width: 60%;
background-color: #eaecf0;
box-shadow: 5px 0 5px -5px rgba(0, 0, 0, 0.25);
overflow-x: hidden;
position: absolute;
}
.menu__left.menu__active nav.top-sm { top: 0; }
.menu__left.menu__active .menu li { background-color: #fff; }
}

View file

@ -1,5 +1,5 @@
<?php
Request::getHead()->addStyles('/assets/css/style.css?16');
Request::getHead()->addStyles('/assets/css/style.css?18');
$type = $data['type'] ?? false;
$facet = $data['facet'] ?? false; ?>
@ -12,7 +12,7 @@ $facet = $data['facet'] ?? false; ?>
<div class="d-header_contents">
<div class="none mb-block">
<div class="menu-left mr10">
<div class="menu__button mr10">
<i class="bi bi-list gray-400 text-xl"></i>
</div>
</div>

View file

@ -1,5 +1,5 @@
<?php
Request::getHead()->addStyles('/assets/css/style.css?16');
Request::getHead()->addStyles('/assets/css/style.css?18');
$type = $data['type'] ?? false;
$facet = $data['facet'] ?? false; ?>