Commit a30033c0 authored by Franco Fichtner's avatar Franco Fichtner

menu: merge new submenu; no functional changes

parent 1cf50d5c
...@@ -7,13 +7,25 @@ ...@@ -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> <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 }}"> <div class="collapse {% if topMenuItem.Selected %} active-menu in {% endif %}" id="{{ topMenuItem.Id }}">
{% for subMenuItem in topMenuItem.Children %} {% for subMenuItem in topMenuItem.Children %}
{% if subMenuItem.IsExternal == "Y" %} {% if subMenuItem.Url == '' %}
<a href="{{ subMenuItem.Url }}" target="_new" class="list-group-item {% if subMenuItem.Selected %} active {% endif %}">{{ subMenuItem.VisibleName }}</a> {# 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) %} {% 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 %} {% endif %}
{% endfor %} {% endfor %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
......
...@@ -18,6 +18,15 @@ ...@@ -18,6 +18,15 @@
<!-- include (theme) style --> <!-- include (theme) style -->
<link href="/ui/themes/{{ui_theme|default('opnsense')}}/build/css/main.css" media="screen, projection" rel="stylesheet"> <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 --> <!-- Favicon -->
<link href="/ui/themes/{{ui_theme|default('opnsense')}}/build/images/favicon.png" rel="shortcut icon"> <link href="/ui/themes/{{ui_theme|default('opnsense')}}/build/images/favicon.png" rel="shortcut icon">
...@@ -44,9 +53,18 @@ ...@@ -44,9 +53,18 @@
}); });
// hide empty menu items // 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) { 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) { ...@@ -163,18 +163,41 @@ if($need_alert_display == true) {
<nav class="page-side-nav" role="navigation"> <nav class="page-side-nav" role="navigation">
<div id="mainmenu" class="panel" style="border:0px" > <div id="mainmenu" class="panel" style="border:0px" >
<div class="panel list-group" style="border:0px"> <div class="panel list-group" style="border:0px">
<?php foreach($menuSystem as $topMenuItem): ?> <?php
<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> foreach($menuSystem as $topMenuItem): ?>
<div class="collapse <?php if ($topMenuItem->Selected) echo 'active-menu in';?>" id="<?php echo $topMenuItem->Id;?>"> <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>
<?php foreach($topMenuItem->Children as $subMenuItem): ?> <div class="collapse <?=$topMenuItem->Selected ? 'active-menu in' :"";?>" id="<?=$topMenuItem->Id;?>">
<?php if ($subMenuItem->IsExternal == "Y" ):?> <?php
<a href="<?php echo $subMenuItem->Url;?>" target="_new" class="list-group-item <?php if ($subMenuItem->Selected ) echo "active";?>"><?php echo $subMenuItem->VisibleName ?></a> foreach($topMenuItem->Children as $subMenuItem): ?>
<?php elseif ($aclObj->isPageAccessible($_SESSION['Username'],$subMenuItem->Url)):?> <?php
<a href="<?php echo $subMenuItem->Url;?>" class="list-group-item <?php if ($subMenuItem->Selected) echo "active";?>"><?php echo $subMenuItem->VisibleName;?></a> if ($subMenuItem->Url == '' ):?>
<?php endif;?> <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>
<?php endforeach; ?> <div class="collapse <?=$subMenuItem->Selected ? "active-menu in" :"";?>" id="<?=$topMenuItem->Id;?>_<?=$subMenuItem->Id;?>">
</div> <?php
<?php endforeach; ?> 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>
</div> </div>
</nav> </nav>
......
...@@ -38,6 +38,14 @@ $pagetitle = gentitle( $pgtitle ); ...@@ -38,6 +38,14 @@ $pagetitle = gentitle( $pgtitle );
<!-- include (theme) style --> <!-- include (theme) style -->
<link href="/ui/themes/<?=$g['theme'];?>/build/css/main.css" media="screen, projection" rel="stylesheet"> <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 --> <!-- Favicon -->
<link href="/ui/themes/<?=$g['theme'];?>/build/images/favicon.png" rel="shortcut icon"> <link href="/ui/themes/<?=$g['theme'];?>/build/images/favicon.png" rel="shortcut icon">
...@@ -100,6 +108,15 @@ $pagetitle = gentitle( $pgtitle ); ...@@ -100,6 +108,15 @@ $pagetitle = gentitle( $pgtitle );
$("input").attr("autocomplete","off"); $("input").attr("autocomplete","off");
// hide empty menu items // 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) { if ($(this).children().length == 0) {
$("#mainmenu").find('[href="#'+$(this).attr('id')+'"]').remove(); $("#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