Commit a30033c0 authored by Franco Fichtner's avatar Franco Fichtner

menu: merge new submenu; no functional changes

parent 1cf50d5c
......@@ -7,13 +7,25 @@
<a href="#{{ topMenuItem.Id }}" class="list-group-item {% if topMenuItem.Selected %} active-menu-title {% endif %}" data-toggle="collapse" data-parent="#mainmenu"><span class="{{ topMenuItem.CssClass }} __iconspacer"></span>{{ topMenuItem.VisibleName }} </a>
<div class="collapse {% if topMenuItem.Selected %} active-menu in {% endif %}" id="{{ topMenuItem.Id }}">
{% for subMenuItem in topMenuItem.Children %}
{% if subMenuItem.IsExternal == "Y" %}
<a href="{{ subMenuItem.Url }}" target="_new" class="list-group-item {% if subMenuItem.Selected %} active {% endif %}">{{ subMenuItem.VisibleName }}</a>
{% if subMenuItem.Url == '' %}
{# next level items, submenu is a container #}
<a href="#{{ topMenuItem.Id }}_{{ subMenuItem.Id }}" class="list-group-item {% if subMenuItem.Selected %} active-menu-title {% endif %}" data-toggle="collapse" data-parent="#{{ topMenuItem.Id }}">{{ subMenuItem.VisibleName }} <span class="{{ subMenuItem.CssClass }} __iconspacer pull-right"></span></a>
<div class="collapse {% if subMenuItem.Selected %} active-menu in {% endif %}" id="{{ topMenuItem.Id }}_{{ subMenuItem.Id }}">
{% for subsubMenuItem in subMenuItem.Children %}
{% if subsubMenuItem.IsExternal == "Y" %}
<a href="{{ subsubMenuItem.Url }}" target="_new" class="list-group-item menu-level-3-item {% if subsubMenuItem.Selected %} active {% endif %}">{{ subsubMenuItem.VisibleName }}</a>
{% elseif acl.isPageAccessible(session.get('Username'),subsubMenuItem.Url) %}
<a href="{{ subsubMenuItem.Url }}" class="list-group-item menu-level-3-item {% if subsubMenuItem.Selected %} active {% endif %}">{{ subsubMenuItem.VisibleName }}</a>
{% endif %}
{% endfor %}
</div>
{% elseif subMenuItem.IsExternal == "Y" %}
<a href="{{ subMenuItem.Url }}" target="_new" class="list-group-item {% if subMenuItem.Selected %} active {% endif %}">{{ subMenuItem.VisibleName }}<span class="{{ subMenuItem.CssClass }} __iconspacer pull-right"></span></a>
{% elseif acl.isPageAccessible(session.get('Username'),subMenuItem.Url) %}
<a href="{{ subMenuItem.Url }}" class="list-group-item {% if subMenuItem.Selected %} active {% endif %}">{{ subMenuItem.VisibleName }}</a>
<a href="{{ subMenuItem.Url }}" class="list-group-item {% if subMenuItem.Selected %} active {% endif %}">{{ subMenuItem.VisibleName }}<span class="{{ subMenuItem.CssClass }} __iconspacer pull-right"></span></a>
{% endif %}
{% endfor %}
</div>
</div>
{% endfor %}
</div>
</div>
......
......@@ -18,6 +18,15 @@
<!-- include (theme) style -->
<link href="/ui/themes/{{ui_theme|default('opnsense')}}/build/css/main.css" media="screen, projection" rel="stylesheet">
<!-- TODO: move to theme style -->
<style>
.menu-level-3-item {
font-size: 90%;
padding-left: 54px !important;
}
</style>
<!-- Favicon -->
<link href="/ui/themes/{{ui_theme|default('opnsense')}}/build/images/favicon.png" rel="shortcut icon">
......@@ -44,9 +53,18 @@
});
// hide empty menu items
$('#mainmenu > div > .collapse').each(function(){
$('#mainmenu > div > .collapse').each(function () {
// cleanup empty second level menu containers
$(this).find("div.collapse").each(function () {
if ($(this).children().length == 0) {
$("#mainmenu").find('[href="#' + $(this).attr('id') + '"]').remove();
$(this).remove();
}
});
// cleanup empty first level menu items
if ($(this).children().length == 0) {
$("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove();
$("#mainmenu").find('[href="#' + $(this).attr('id') + '"]').remove();
}
});
......
......@@ -163,18 +163,41 @@ if($need_alert_display == true) {
<nav class="page-side-nav" role="navigation">
<div id="mainmenu" class="panel" style="border:0px" >
<div class="panel list-group" style="border:0px">
<?php foreach($menuSystem as $topMenuItem): ?>
<a href="#<?php echo $topMenuItem->Id;?>" class="list-group-item <?php if ($topMenuItem->Selected) echo 'active-menu-title'; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="<?php echo $topMenuItem->CssClass;?> __iconspacer"></span><?php echo $topMenuItem->VisibleName;?> </a>
<div class="collapse <?php if ($topMenuItem->Selected) echo 'active-menu in';?>" id="<?php echo $topMenuItem->Id;?>">
<?php foreach($topMenuItem->Children as $subMenuItem): ?>
<?php if ($subMenuItem->IsExternal == "Y" ):?>
<a href="<?php echo $subMenuItem->Url;?>" target="_new" class="list-group-item <?php if ($subMenuItem->Selected ) echo "active";?>"><?php echo $subMenuItem->VisibleName ?></a>
<?php elseif ($aclObj->isPageAccessible($_SESSION['Username'],$subMenuItem->Url)):?>
<a href="<?php echo $subMenuItem->Url;?>" class="list-group-item <?php if ($subMenuItem->Selected) echo "active";?>"><?php echo $subMenuItem->VisibleName;?></a>
<?php endif;?>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
<?php
foreach($menuSystem as $topMenuItem): ?>
<a href="#<?=$topMenuItem->Id;?>" class="list-group-item <?= $topMenuItem->Selected ? 'active-menu-title' : ""; ?>" data-toggle="collapse" data-parent="#mainmenu"><span class="<?=$topMenuItem->CssClass;?> __iconspacer"></span><?=$topMenuItem->VisibleName;?> </a>
<div class="collapse <?=$topMenuItem->Selected ? 'active-menu in' :"";?>" id="<?=$topMenuItem->Id;?>">
<?php
foreach($topMenuItem->Children as $subMenuItem): ?>
<?php
if ($subMenuItem->Url == '' ):?>
<a href="#<?=$topMenuItem->Id;?>_<?=$subMenuItem->Id;?>" class="list-group-item <?=$subMenuItem->Selected ? "active-menu-title" : "";?>" data-toggle="collapse" data-parent="#<?=$topMenuItem->Id;?>"><?=$subMenuItem->VisibleName;?><span class="<?=$subMenuItem->CssClass;?> __iconspacer pull-right"></span></a>
<div class="collapse <?=$subMenuItem->Selected ? "active-menu in" :"";?>" id="<?=$topMenuItem->Id;?>_<?=$subMenuItem->Id;?>">
<?php
foreach ($subMenuItem->Children as $subsubMenuItem):?>
<?php
if ($subsubMenuItem->IsExternal == "Y"):?>
<a href="<?=$subsubMenuItem->Url;?>" target="_new" class="list-group-item menu-level-3-item <?=$subsubMenuItem->Selected ? "active" :"";?>"><?=$subsubMenuItem->VisibleName;?></a>
<?php
elseif ($aclObj->isPageAccessible($_SESSION['Username'],$subsubMenuItem->Url)):?>
<a href="<?=$subsubMenuItem->Url;?>" class="list-group-item menu-level-3-item <?=$subsubMenuItem->Selected ? "active" :"";?>"><?=$subsubMenuItem->VisibleName;?></a>
<?php
endif;
endforeach;?>
</div>
<?php
elseif ($subMenuItem->IsExternal == "Y" ):?>
<a href="<?=$subMenuItem->Url;?>" target="_new" class="list-group-item <?=$subMenuItem->Selected ? "active" : "";?>"><?=$subMenuItem->VisibleName ?><span class="<?=$subMenuItem->CssClass;?> __iconspacer pull-right"></span></a>
<?php
elseif ($aclObj->isPageAccessible($_SESSION['Username'],$subMenuItem->Url)):?>
<a href="<?=$subMenuItem->Url;?>" class="list-group-item <?=$subMenuItem->Selected ? "active" :"";?>"><?=$subMenuItem->VisibleName;?><span class="<?=$subMenuItem->CssClass;?> __iconspacer pull-right"></span></a>
<?php
endif;?>
<?php
endforeach; ?>
</div>
<?php
endforeach; ?>
</div>
</div>
</nav>
......
......@@ -38,6 +38,14 @@ $pagetitle = gentitle( $pgtitle );
<!-- include (theme) style -->
<link href="/ui/themes/<?=$g['theme'];?>/build/css/main.css" media="screen, projection" rel="stylesheet">
<!-- TODO: move to theme style -->
<style>
.menu-level-3-item {
font-size: 90%;
padding-left: 54px !important;
}
</style>
<!-- Favicon -->
<link href="/ui/themes/<?=$g['theme'];?>/build/images/favicon.png" rel="shortcut icon">
......@@ -100,6 +108,15 @@ $pagetitle = gentitle( $pgtitle );
$("input").attr("autocomplete","off");
// hide empty menu items
$('#mainmenu > div > .collapse').each(function(){
// cleanup empty second level menu containers
$(this).find("div.collapse").each(function(){
if ($(this).children().length == 0 ) {
$("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove();
$(this).remove();
}
});
// cleanup empty first level menu items
if ($(this).children().length == 0) {
$("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment