Tweak the main menu a bit

This commit is contained in:
Timothy Warren 2017-04-17 12:45:29 -04:00
parent 921d594931
commit 6111dfe6f9

View File

@ -1,25 +1,38 @@
<?php declare(strict_types=1); namespace Aviat\AnimeClient; ?> <?php declare(strict_types=1);
namespace Aviat\AnimeClient;
$whose = $config->get('whose_list') . "'s ";
$lastSegment = $urlGenerator->lastSegment();
$extraSegment = $lastSegment === 'list' ? '/list' : '';
?>
<h1 class="flex flex-align-end flex-wrap"> <h1 class="flex flex-align-end flex-wrap">
<span class="flex-no-wrap grow-1"> <span class="flex-no-wrap grow-1">
<?php if(strpos($route_path, 'collection') === FALSE): ?> <?php if(strpos($route_path, 'collection') === FALSE): ?>
<a href="<?= $escape->attr($urlGenerator->defaultUrl($url_type)) ?>"> <?= $whose . ucfirst($url_type) . ' List' ?>
<?= $config->get('whose_list') ?>'s <?= ucfirst($url_type) ?> List
</a>
<?php if($config->get("show_{$url_type}_collection")): ?> <?php if($config->get("show_{$url_type}_collection")): ?>
[<a href="<?= $url->generate('collection.view') ?>"><?= ucfirst($url_type) ?> Collection</a>] [<?= $helper->a(
$url->generate('collection.view'),
ucfirst($url_type) . ' Collection'
) ?>]
<?php endif ?> <?php endif ?>
[<a href="<?= $urlGenerator->defaultUrl($other_type) ?>"><?= ucfirst($other_type) ?> List</a>] [<?= $helper->a(
$urlGenerator->defaultUrl($other_type) . $extraSegment,
ucfirst($other_type) . ' List'
) ?>]
<?php else: ?> <?php else: ?>
<a href="<?= $url->generate('collection.view') ?>"> <?= $whose . ucfirst($url_type) . ' Collection' ?>
<?= $config->get('whose_list') ?>'s <?= ucfirst($url_type) ?> Collection [<?= $helper->a($urlGenerator->defaultUrl('anime'), 'Anime List') ?>]
</a> [<?= $helper->a($urlGenerator->defaultUrl('manga'), 'Manga List') ?>]
[<a href="<?= $urlGenerator->defaultUrl('anime') ?>">Anime List</a>]
[<a href="<?= $urlGenerator->defaultUrl('manga') ?>">Manga List</a>]
<?php endif ?> <?php endif ?>
</span> </span>
<span class="flex-no-wrap small-font">
[<?= $helper->a($url->generate('user_info'), 'About '. $config->get('whose_list')) ?>] <span class="flex-no-wrap small-font">[<?= $helper->a(
</span> $url->generate('user_info'),
'About '. $config->get('whose_list')
) ?>]</span>
<?php if ($auth->isAuthenticated()): ?> <?php if ($auth->isAuthenticated()): ?>
<span class="flex-no-wrap">&nbsp;</span> <span class="flex-no-wrap">&nbsp;</span>
<span class="flex-no-wrap small-font"> <span class="flex-no-wrap small-font">
@ -27,11 +40,16 @@
</span> </span>
<span class="flex-no-wrap">&nbsp;</span> <span class="flex-no-wrap">&nbsp;</span>
<?php endif ?> <?php endif ?>
<span class="flex-no-wrap small-font"> <span class="flex-no-wrap small-font">
<?php if ($auth->isAuthenticated()): ?> <?php if ($auth->isAuthenticated()): ?>
<a class="bracketed" href="<?= $url->generate('logout') ?>">Logout</a> <?= $helper->a(
$url->generate('logout'),
'Logout',
['class' => 'bracketed']
) ?>
<?php else: ?> <?php else: ?>
[<a href="<?= $url->generate('login'); ?>"><?= $config->get('whose_list') ?>'s Login</a>] [<?= $helper->a($url->generate('login'), "{$whose} Login") ?>]
<?php endif ?> <?php endif ?>
</span> </span>
</h1> </h1>
@ -40,8 +58,8 @@
<?= $helper->menu($menu_name) ?> <?= $helper->menu($menu_name) ?>
<br /> <br />
<ul> <ul>
<li class="<?= Util::isNotSelected('list', $urlGenerator->lastSegment()) ?>"><a href="<?= $urlGenerator->url($route_path) ?>">Cover View</a></li> <li class="<?= Util::isNotSelected('list', $lastSegment) ?>"><a href="<?= $urlGenerator->url($route_path) ?>">Cover View</a></li>
<li class="<?= Util::isSelected('list', $urlGenerator->lastSegment()) ?>"><a href="<?= $urlGenerator->url("{$route_path}/list") ?>">List View</a></li> <li class="<?= Util::isSelected('list', $lastSegment) ?>"><a href="<?= $urlGenerator->url("{$route_path}/list") ?>">List View</a></li>
</ul> </ul>
<?php endif ?> <?php endif ?>
</nav> </nav>