🚸 (navbar): persistent navbar
This commit is contained in:
parent
bfb58fbfb5
commit
3c8c36f347
5 changed files with 61 additions and 45 deletions
|
@ -23,6 +23,10 @@ body {
|
|||
padding: 1rem;
|
||||
}
|
||||
|
||||
.dropdown-item:focus, .dropdown-item:hover {
|
||||
background-color: rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
.admin-sidebar h4 {
|
||||
font-weight: bolder;
|
||||
font-size: 1rem;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark text-uppercase d-block d-lg-none">
|
||||
<div class="container">
|
||||
<span class="navbar-brand">🦎 KOBLOG</span>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false"
|
||||
aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary mb-3">
|
||||
<div class="container-fluid">
|
||||
<span class="navbar-brand text-uppercase">🦎 KOBLOG</span>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0 align-items-center">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>">
|
||||
<?php $L->p('Dashboard') ?></a>
|
||||
</li>
|
||||
|
@ -15,38 +14,34 @@
|
|||
<a class="nav-link" href="<?php echo HTML_PATH_ROOT ?>">
|
||||
<?php $L->p('Website') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>">
|
||||
<?php $L->p('New content') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'content' ?>">
|
||||
<?php $L->p('Content') ?></a>
|
||||
</li>
|
||||
<?php if (!checkRole(array('admin'),false)): ?>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$login->username() ?>">
|
||||
<?php $L->p('Profile') ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (checkRole(array('admin'),false)): ?>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'categories' ?>">
|
||||
<?php $L->p('Categories') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'users' ?>">
|
||||
<?php $L->p('Users') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'settings' ?>">
|
||||
<?php $L->p('Settings') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'plugins' ?>">
|
||||
<?php $L->p('Plugins') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>">
|
||||
<?php $L->p('Themes') ?></a>
|
||||
</li>
|
||||
|
@ -59,18 +54,44 @@
|
|||
<?php
|
||||
if (!empty($plugins['adminSidebar'])) {
|
||||
foreach ($plugins['adminSidebar'] as $pluginSidebar) {
|
||||
echo '<li class="nav-item">';
|
||||
echo '<li class="nav-item d-lg-none">';
|
||||
echo $pluginSidebar->adminSidebar();
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php endif; ?>
|
||||
<li class="nav-item">
|
||||
<li class="nav-item d-lg-none">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>">
|
||||
<?php $L->p('Logout') ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav mb-2 mb-lg-0 align-items-center d-none d-lg-flex">
|
||||
<li class="nav-item mx-1">
|
||||
<div class="btn-group dropdown">
|
||||
<a class="btn btn-sm btn-outline-primary" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span class="fa fa-plus-circle"></span><?php $L->p('New') ?></a>
|
||||
<button type="button" class="btn btn-sm btn-outline-primary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<span class="visually-hidden">Toggle Dropdown</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li>
|
||||
<a class="dropdown-item" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>">
|
||||
<?php $L->p('New content') ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="nav-item dropdown ms-1">
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<?php echo $login->getUserData()->displayName(); ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item" href="<?php echo HTML_PATH_ADMIN_ROOT.'edit-user/'.$login->username() ?>"><?php $L->p('Profile') ?></a></a></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><a class="dropdown-item" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><?php $L->p('Logout') ?></a></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
|
|
@ -1,19 +1,7 @@
|
|||
<!-- Use .flex-column to set a vertical direction -->
|
||||
<ul class="nav flex-column pt-4">
|
||||
|
||||
<li class="nav-item mb-4" style="margin-left: -4px;">
|
||||
<span class="ml-2 align-middle">🦎 KOBLOG</span>
|
||||
</li>
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="fa fa-dashboard fa-fw"></span><?php $L->p('Dashboard') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" target="_blank" href="<?php echo HTML_PATH_ROOT ?>"><span class="fa fa-home fa-fw "></span><?php $L->p('Website') ?></a>
|
||||
</li>
|
||||
|
||||
<li class="nav-item mt-3">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'new-content' ?>"><span style="color: #0078D4;" class="fa fa-plus-circle"></span><?php $L->p('New content') ?></a>
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'dashboard' ?>"><span class="fa fa-globe fa-fw"></span><?php $L->p('Dashboard') ?></a>
|
||||
</li>
|
||||
|
||||
<?php if (!checkRole(array('admin'),false)): ?>
|
||||
|
@ -53,9 +41,6 @@
|
|||
<li class="nav-item">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'themes' ?>"><span class="fa fa-desktop fa-fw"></span><?php $L->p('Themes') ?></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'about' ?>"><span class="fa fa-info fa-fw"></span><?php $L->p('About') ?></a>
|
||||
</li>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -73,8 +58,4 @@
|
|||
?>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<li class="nav-item mt-5">
|
||||
<a class="nav-link" href="<?php echo HTML_PATH_ADMIN_ROOT.'logout' ?>"><span class="fa fa-arrow-circle-right fa-fw"></span><?php $L->p('Logout') ?></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -62,13 +62,13 @@
|
|||
|
||||
|
||||
<!-- LEFT SIDEBAR - Display only on large devices -->
|
||||
<div class="bg-dark admin-sidebar text-white d-none d-lg-block">
|
||||
<div class="bg-dark admin-sidebar text-white d-none d-lg-block h-100">
|
||||
<?php include('html/sidebar.php'); ?>
|
||||
</div>
|
||||
|
||||
<div class="container h-100" id="main-area">
|
||||
<div class="h-100" id="main-area">
|
||||
<!-- 25%/75% split on large devices, small, medium devices hide -->
|
||||
<div class="row h-100">
|
||||
<div class="h-100">
|
||||
|
||||
<!-- Alert -->
|
||||
<?php include('html/alert.php'); ?>
|
||||
|
@ -77,7 +77,7 @@
|
|||
<?php include('html/navbar.php'); ?>
|
||||
|
||||
<!-- RIGHT MAIN -->
|
||||
<div class="h-100">
|
||||
<div class="container h-100">
|
||||
<?php
|
||||
if (Sanitize::pathFile(PATH_ADMIN_VIEWS, $layout['view'].'.php')) {
|
||||
include(PATH_ADMIN_VIEWS.$layout['view'].'.php');
|
||||
|
|
|
@ -172,6 +172,16 @@ class Login
|
|||
return sha1($agent);
|
||||
}
|
||||
|
||||
public function getUserData()
|
||||
{
|
||||
try {
|
||||
$user = new User($this->username());
|
||||
return $user;
|
||||
} catch (Exception $e) {
|
||||
// Continue without permissions
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$this->invalidateRememberMe();
|
||||
|
|
Loading…
Reference in a new issue