mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 09:52:22 +00:00
- Added navigation.php in application/config to configure menus used by NavigationWidget
- Addded controller system/Navigation to retrive menus via ajax - Renamed method _setNavigationMenuArray to setNavigationMenuArray and set as public in system/infocenter/InfoCenter - Now the InfoCenter menu is stored in the session - The menu is generated by the widget NavigationWidget via JS - No need anymore to give as parameters to the views the menu arrays
This commit is contained in:
@@ -1,14 +1,3 @@
|
||||
<div class="navbar-default sidebar" role="navigation">
|
||||
<div class="sidebar-nav navbar-collapse">
|
||||
<ul class="nav" id="side-menu">
|
||||
<li id="collapseicon" class="text-right" style="cursor: pointer; color: #337ab7">
|
||||
<i class="fa fa-angle-double-left fa-fw"></i>
|
||||
</li>
|
||||
<?php NavigationMenuWidget::printNavigationMenu(); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<i id="collapseinicon" class="fa fa-angle-double-right fa-fw"></i>
|
||||
</div>
|
||||
<style>
|
||||
#collapseinicon {
|
||||
display: none;
|
||||
@@ -23,16 +12,15 @@
|
||||
background-color: #F8F8F8;
|
||||
}
|
||||
|
||||
.nav > li > span {
|
||||
position: relative;
|
||||
display: block;
|
||||
.nav > li > span > a:focus, .nav > li > span > a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav > li > span > a {
|
||||
display: inline;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-right: 123px;
|
||||
.nav > li > span {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.menuSubscriptLink {
|
||||
@@ -48,20 +36,129 @@
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
|
||||
// Hiding/showing navigation menu - works only with sb admin 2 template!!
|
||||
<script language="Javascript" type="text/javascript">
|
||||
|
||||
$("#collapseicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '0px');
|
||||
$("#side-menu").hide();
|
||||
$("#collapseinicon").show();
|
||||
});
|
||||
function printNavItem(item, depth = 1)
|
||||
{
|
||||
strMenu = "";
|
||||
var expanded = typeof item['expand'] != 'undefined' && item['expand'] === true ? ' active' : '';
|
||||
|
||||
strMenu += '<li class="' + expanded + '">';
|
||||
|
||||
if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined')
|
||||
{
|
||||
strMenu += '<span>';
|
||||
}
|
||||
|
||||
strMenu += '<a href="' + item['link'] + '"' + expanded + '>';
|
||||
|
||||
if (item['icon'] != 'undefined')
|
||||
{
|
||||
strMenu += '<i class="fa fa-' + item['icon'] + ' fa-fw"></i> ';
|
||||
}
|
||||
|
||||
strMenu += item['description'];
|
||||
|
||||
if (typeof item['children'] != 'undefined' && Object.keys(item['children']).length > 0)
|
||||
{
|
||||
strMenu += '<span class="fa arrow"></span>';
|
||||
}
|
||||
|
||||
strMenu += '</a>';
|
||||
|
||||
if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined')
|
||||
{
|
||||
strMenu += '<a class="' + item['subscriptLinkClass'] + ' menuSubscriptLink" value="' + item['subscriptLinkValue'] + '" href="#"> (' + item['subscriptDescription'] + ')</a>';
|
||||
strMenu += '</span>';
|
||||
}
|
||||
|
||||
if (typeof item['children'] != 'undefined' && Object.keys(item['children']).length > 0)
|
||||
{
|
||||
var level = '';
|
||||
if (depth === 1)
|
||||
{
|
||||
level = 'second';
|
||||
}
|
||||
else if (depth > 1)
|
||||
{
|
||||
level = 'third';
|
||||
}
|
||||
|
||||
strMenu += '<ul class="nav nav-' + level + '-level" ' + expanded + '>';
|
||||
|
||||
jQuery.each(item['children'], function(i, e) {
|
||||
strMenu += printNavItem(e, ++depth);
|
||||
});
|
||||
|
||||
strMenu += '</ul>';
|
||||
}
|
||||
|
||||
strMenu += '</li>';
|
||||
|
||||
return strMenu;
|
||||
}
|
||||
|
||||
function renderSideMenu()
|
||||
{
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('index.ci.php/system/Navigation/menu'); ?>",
|
||||
method: "GET",
|
||||
data: {
|
||||
navigation_widget_called: "<?php echo $this->router->directory.$this->router->class.'/'.$this->router->method; ?>"
|
||||
}
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
var strMenu = '';
|
||||
|
||||
$("#side-menu").html('<li id="collapseicon" class="text-right" style="cursor: pointer; color: #337ab7"><i class="fa fa-angle-double-left fa-fw"></i></li>');
|
||||
|
||||
jQuery.each(data, function(i, e) {
|
||||
strMenu += printNavItem(e);
|
||||
});
|
||||
|
||||
$("#side-menu").append(strMenu);
|
||||
$("#side-menu").metisMenu();
|
||||
}
|
||||
|
||||
if (typeof sideMenuHook == 'function')
|
||||
{
|
||||
sideMenuHook();
|
||||
}
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
renderSideMenu();
|
||||
|
||||
// Hiding/showing navigation menu - works only with sb admin 2 template!!
|
||||
|
||||
$("#collapseicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '0px');
|
||||
$("#side-menu").hide();
|
||||
$("#collapseinicon").show();
|
||||
});
|
||||
|
||||
$("#collapseinicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '250px');
|
||||
$("#side-menu").show();
|
||||
$("#collapseinicon").hide();
|
||||
});
|
||||
|
||||
$("#collapseinicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '250px');
|
||||
$("#side-menu").show();
|
||||
$("#collapseinicon").hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="navbar-default sidebar" role="navigation">
|
||||
<div class="sidebar-nav navbar-collapse">
|
||||
<ul class="nav" id="side-menu"></ul>
|
||||
</div>
|
||||
<i id="collapseinicon" class="fa fa-angle-double-right fa-fw"></i>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user