Merge branch 'add-hamburger-menu' into develop

This commit is contained in:
Jay Trees 2022-02-28 09:51:32 +01:00
commit 9f88c96c03
14 changed files with 150 additions and 36 deletions

View file

@ -211,3 +211,28 @@ p .ui.horizontal.label {
margin-bottom: 0;
}
}
/**
* Menu
*/
.pusher .menu.toggle {
display: none;
}
.ui.attached.menu.sidebar:not(.tabular) {
border: 0;
}
@media (max-width: 767px) {
.pusher .menu.toggle {
display: block;
}
.pusher > .footer {
display: none;
}
.pusher .menu.attached.desktop {
display: none;
}
}

View file

@ -95,6 +95,14 @@ $(function() {
$.fn.toast.settings.class = 'success';
$.fn.toast.settings.showIcon = 'check';
$.fn.toast.settings.title = 'Success';
/**
* Menu
*/
$(document).on('click', '.menu.toggle', function() {
$('.menu.sidebar').sidebar('show');
});
});
/**

View file

@ -219,6 +219,12 @@ class Page
<title><?= $this->title ?> - wishthis</title>
</head>
<?php
}
public function bodyStart(): void
{
?>
<body>
<?php
}
@ -255,56 +261,103 @@ class Page
);
}
?>
<div class="ui attached stackable menu">
<div class="ui attached stackable vertical menu sidebar">
<div class="ui container">
<a class="item home" href="/?page=home">
<img src="/src/assets/img/logo.svg" />
<img src="/src/assets/img/logo.svg" alt="wishthis logo" />
</a>
<a class="item" href="/?page=wishlists">
<i class="list icon"></i>
My lists
</a>
<div class="right menu">
<?php global $options; ?>
<?php global $options; ?>
<?php if ($options->updateAvailable && $user && 100 === $user->power) { ?>
<a class="item" href="/?page=update">
<i class="upload icon"></i> Update
</a>
<?php } ?>
<?php if ($options->updateAvailable && $user && 100 === $user->power) { ?>
<a class="item" href="/?page=update">
<i class="upload icon"></i> Update
</a>
<?php } ?>
<?php if (count($pagesAccount) === 1) { ?>
<a class="item" href="<?= $pagesAccount[0]['url'] ?>">
<i class="<?= $pagesAccount[0]['icon'] ?> icon"></i>
<?= $pagesAccount[0]['text'] ?>
</a>
<?php } elseif (count($pagesAccount) >= 2) { ?>
<div class="ui simple dropdown item">
<i class="user circle icon"></i>
Account
<i class="dropdown icon"></i>
<div class="menu">
<?php
if (count($pagesAccount) >= 2) {
foreach ($pagesAccount as $item) {
?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php
<?php
foreach ($pagesAccount as $item) {
?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php
}
?>
</div>
<?= $this->footer() ?>
</div>
<div class="pusher">
<div class="ui attached menu desktop">
<div class="ui container">
<a class="item home" href="/?page=home">
<img src="/src/assets/img/logo.svg" />
</a>
<a class="item" href="/?page=wishlists">
<i class="list icon"></i>
My lists
</a>
<div class="right menu">
<?php global $options; ?>
<?php if ($options->updateAvailable && $user && 100 === $user->power) { ?>
<a class="item" href="/?page=update">
<i class="upload icon"></i> Update
</a>
<?php } ?>
<?php if (count($pagesAccount) === 1) { ?>
<a class="item" href="<?= $pagesAccount[0]['url'] ?>">
<i class="<?= $pagesAccount[0]['icon'] ?> icon"></i>
<?= $pagesAccount[0]['text'] ?>
</a>
<?php } elseif (count($pagesAccount) >= 2) { ?>
<div class="ui simple dropdown item">
<i class="user circle icon"></i>
Account
<i class="dropdown icon"></i>
<div class="menu">
<?php
if (count($pagesAccount) >= 2) {
foreach ($pagesAccount as $item) {
?>
<a class="item" href="<?= $item['url'] ?>">
<i class="<?= $item['icon'] ?> icon"></i>
<?= $item['text'] ?>
</a>
<?php
}
}
}
?>
?>
</div>
</div>
</div>
<?php } ?>
<?php } ?>
</div>
</div>
</div>
</div>
<div class="ui hidden divider"></div>
<?php
<div class="ui attached stackable menu toggle">
<div class="ui container">
<a class="item">
<i class="hamburger icon"></i>
Menu
</a>
</div>
</div>
<div class="ui hidden divider"></div>
<?php
}
public function footer(): void
@ -336,6 +389,13 @@ class Page
</div>
</div>
</div>
<?php
}
public function bodyEnd(): void
{
?>
</div><!-- Pusher -->
</body>
</html>

View file

@ -10,6 +10,7 @@ use wishthis\Page;
$page = new page(__FILE__, 'Home');
$page->header();
$page->bodyStart();
$page->navigation();
?>
@ -74,4 +75,5 @@ $page->navigation();
<?php
$page->footer();
$page->bodyEnd();
?>

View file

@ -15,6 +15,7 @@ if ($options && $options->getOption('isInstalled')) {
$page = new page(__FILE__, 'Install');
$page->header();
$page->bodyStart();
$step = isset($_POST['step']) ? $_POST['step'] : 1;

View file

@ -25,6 +25,7 @@ if (isset($_POST['email'])) {
}
$page->header();
$page->bodyStart();
$page->navigation();
?>
<main>
@ -56,3 +57,4 @@ $page->navigation();
<?php
$page->footer();
$page->bodyEnd();

View file

@ -37,6 +37,7 @@ if (isset($_SESSION['user'])) {
}
$page->header();
$page->bodyStart();
$page->navigation();
?>
<main>
@ -69,3 +70,4 @@ $page->navigation();
<?php
$page->footer();
$page->bodyEnd();

View file

@ -18,6 +18,7 @@ if (PHP_SESSION_ACTIVE === session_status()) {
}
$page->header();
$page->bodyStart();
$page->navigation();
?>
<main>
@ -33,3 +34,4 @@ $page->navigation();
<?php
$page->footer();
$page->bodyEnd();

View file

@ -10,6 +10,7 @@ use wishthis\Page;
$page = new page(__FILE__, 'Insufficient power');
$page->header();
$page->bodyStart();
$page->navigation();
?>
@ -29,4 +30,5 @@ $page->navigation();
<?php
$page->footer();
$page->bodyEnd();
?>

View file

@ -82,6 +82,7 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
}
$page->header();
$page->bodyStart();
$page->navigation();
?>
<main>
@ -140,3 +141,4 @@ $page->navigation();
</main>
<?php
$page->footer();
$page->bodyEnd();

View file

@ -10,6 +10,7 @@ use wishthis\{Page, User};
$page = new page(__FILE__, 'Update', 100);
$page->header();
$page->bodyStart();
$page->navigation();
/**
@ -127,4 +128,5 @@ if ('POST' === $_SERVER['REQUEST_METHOD']) {
<?php
$page->footer();
$page->bodyEnd();
?>

View file

@ -43,6 +43,7 @@ if (!$userIsAuthenticated) {
$page = new page(__FILE__, $wish->title);
$page->header();
$page->bodyStart();
$page->navigation();
$referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
@ -213,4 +214,5 @@ $referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
<?php
$page->footer();
$page->bodyEnd();
?>

View file

@ -21,6 +21,7 @@ if (!$wishlist->exists) {
$page = new page(__FILE__, $wishlist->data['name']);
$page->header();
$page->bodyStart();
$page->navigation();
?>
@ -84,4 +85,5 @@ $page->navigation();
<?php
$page->footer();
$page->bodyEnd();
?>

View file

@ -10,6 +10,7 @@ use wishthis\{Page, User, Wishlist};
$page = new page(__FILE__, 'My lists');
$page->header();
$page->bodyStart();
$page->navigation();
?>
<main>
@ -165,3 +166,4 @@ $page->navigation();
<?php
$page->footer();
$page->bodyEnd();