mirror of
https://github.com/unraid/webgui.git
synced 2026-01-06 09:39:58 -06:00
refactor: enhance navigation structure in Main.php by improving template usage and updating CSS for better layout and alignment
This commit is contained in:
@@ -1,44 +1,84 @@
|
||||
<?
|
||||
// Build page menus
|
||||
echo "<div id='menu'>";
|
||||
if ($themeHelper->isSidebarTheme()) echo "<div id='nav-block'>";
|
||||
echo "<div class='nav-tile'>";
|
||||
foreach ($taskPages as $button) {
|
||||
$page = $button['name'];
|
||||
$play = $task==$page ? " active" : "";
|
||||
echo "<div class='nav-item{$play}'>";
|
||||
echo "<a href=\"/$page\" onclick=\"initab('/$page')\">"._(_var($button,'Name',$page))."</a></div>";
|
||||
}
|
||||
unset($taskPages);
|
||||
echo "</div>";
|
||||
echo "<div class='nav-tile right'>";
|
||||
if (isset($myPage['Lock'])) {
|
||||
$title = $themeHelper->isSidebarTheme() ? "" : _('Unlock sortable items');
|
||||
echo "<div class='nav-item LockButton util'><a href='#' class='hand' onclick='LockButton();return false;' title=\"$title\"><b class='icon-u-lock system green-text'></b><span>"._('Unlock sortable items')."</span></a></div>";
|
||||
}
|
||||
if ($display['usage']) my_usage();
|
||||
/**
|
||||
* Template is used for both top navigation and sidebar navigation.
|
||||
*
|
||||
* @var $themeHelper ThemeHelper
|
||||
* @var $taskPages array
|
||||
* @var $buttonPages array
|
||||
* @var $display array
|
||||
* @var $task string
|
||||
*/
|
||||
?>
|
||||
<div id="menu">
|
||||
<? if ($themeHelper->isSidebarTheme()): ?>
|
||||
<div id="nav-block">
|
||||
<? endif; ?>
|
||||
|
||||
foreach ($buttonPages as $button) {
|
||||
if (empty($button['Link'])) {
|
||||
$icon = $button['Icon'];
|
||||
if (substr($icon,-4)=='.png') {
|
||||
$icon = "<img src='/{$button['root']}/icons/$icon' class='system'>";
|
||||
} elseif (substr($icon,0,5)=='icon-') {
|
||||
$icon = "<b class='$icon system'></b>";
|
||||
} else {
|
||||
if (substr($icon,0,3)!='fa-') $icon = "fa-$icon";
|
||||
$icon = "<b class='fa $icon system'></b>";
|
||||
}
|
||||
$title = $themeHelper->isSidebarTheme() ? "" : " title=\""._($button['Title'])."\"";
|
||||
echo "<div class='nav-item {$button['name']} util'><a href='"._var($button,'Href','#')."' onclick='{$button['name']}();return false;'{$title}>$icon<span>"._($button['Title'])."</span></a></div>";
|
||||
} else {
|
||||
echo "<div class='{$button['Link']}'></div>";
|
||||
}
|
||||
}
|
||||
<div class="nav-tile">
|
||||
<? foreach ($taskPages as $button): ?>
|
||||
<? $pageName = $button['name']; ?>
|
||||
<? $pageActive = $task == $pageName ? " active" : ""; ?>
|
||||
<div class="nav-item<?= $pageActive ?>">
|
||||
<a href="/<?= $pageName ?>" onclick="initab('/<?= $pageName ?>')">
|
||||
<?= _(_var($button, 'Name', $pageName)) ?>
|
||||
</a>
|
||||
</div>
|
||||
<? endforeach; ?>
|
||||
<? unset($taskPages); ?>
|
||||
</div>
|
||||
|
||||
echo "<div class='nav-user show'><a id='board' href='#' class='hand'><b id='bell' class='icon-u-bell system'></b></a></div>";
|
||||
<div class="nav-tile right">
|
||||
<? if (isset($myPage['Lock'])): ?>
|
||||
<div class="nav-item LockButton util">
|
||||
<a href="#" class="hand" onclick="LockButton();return false;" title="<?= _('Unlock sortable items') ?>">
|
||||
<b class="icon-u-lock system green-text"></b>
|
||||
<span><?= _('Unlock sortable items') ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
|
||||
if ($themeHelper->isSidebarTheme()) echo "</div>";
|
||||
echo "</div></div>";
|
||||
<? if ($display['usage']): ?>
|
||||
<? my_usage(); ?>
|
||||
<? endif; ?>
|
||||
|
||||
unset($buttonPages,$button);
|
||||
<? foreach ($buttonPages as $button): ?>
|
||||
<? if (empty($button['Link'])): ?>
|
||||
<? $icon = $button['Icon']; ?>
|
||||
<? if (substr($icon, -4) == '.png'): ?>
|
||||
<? $icon = "<img src='/{$button['root']}/icons/$icon' class='system'>"; ?>
|
||||
<? elseif (substr($icon, 0, 5) == 'icon-'): ?>
|
||||
<? $icon = "<b class='$icon system'></b>"; ?>
|
||||
<? else: ?>
|
||||
<? if (substr($icon, 0, 3) != 'fa-'): ?>
|
||||
<? $icon = "fa-$icon"; ?>
|
||||
<? endif; ?>
|
||||
<? $icon = "<b class='fa $icon system'></b>"; ?>
|
||||
<? endif; ?>
|
||||
|
||||
<div class="nav-item <?= $button['name'] ?> util">
|
||||
<a
|
||||
href="<?= _var($button, 'Href', '#') ?>"
|
||||
onclick="<?= $button['name'] ?>();return false;"
|
||||
title="<?= _($button['Title']) ?>"
|
||||
>
|
||||
<?= $icon ?>
|
||||
<span><?= _($button['Title']) ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<? else: ?>
|
||||
<div class="<?= $button['Link'] ?>"></div>
|
||||
<? endif; ?>
|
||||
<? endforeach; ?>
|
||||
<? unset($buttonPages, $button); ?>
|
||||
|
||||
<div class="nav-user show">
|
||||
<a id="board" href="#" class="hand">
|
||||
<b id="bell" class="icon-u-bell system"></b>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<? if ($themeHelper->isSidebarTheme()): ?>
|
||||
</div>
|
||||
<? endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user