Fix generating sidebar

This commit is contained in:
printempw 2018-02-23 16:51:50 +08:00
parent 98e27151ff
commit 9bf7dccb64
4 changed files with 7 additions and 7 deletions

View File

@ -166,16 +166,18 @@ if (! function_exists('bs_menu')) {
}
$classes = [];
$active ? ($classes[] = 'active') : null;
$active ? ($classes[] = 'active menu-open') : null;
isset($value['children']) ? ($classes[] = 'treeview') : null;
$content .= sprintf('<li class="%s">', implode(' ', $classes));
$attr = count($classes) ? sprintf(' class="%s"', implode(' ', $classes)) : '';
$content .= "<li{$attr}>";
if (isset($value['children'])) {
$content .= sprintf('<a href="#"><i class="fa %s"></i> <span>%s</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>', $value['icon'], trans($value['title']));
// recurse
$content .= '<ul class="treeview-menu" style="display: none;">'.bs_menu_render($value['children']).'</ul>';
$content .= '<ul class="treeview-menu">'.bs_menu_render($value['children']).'</ul>';
} else {
$content .= sprintf('<a href="%s"><i class="fa %s"></i> <span>%s</span></a>', url($value['link']), $value['icon'], trans($value['title']));
}

View File

@ -12,8 +12,6 @@ $.defaultPaginatorConfig = {
};
$(document).ready(() => {
$('li.active > ul').show();
$('input').iCheck({
radioClass: 'iradio_square-blue',
checkboxClass: 'icheckbox_square-blue'

View File

@ -63,7 +63,7 @@
</div>
<!-- Sidebar Menu -->
<ul class="sidebar-menu">
<ul class="sidebar-menu tree" data-widget="tree">
<li class="header">{{ trans('general.admin-panel') }}</li>
{!! bs_menu('admin') !!}

View File

@ -61,7 +61,7 @@
</div>
<!-- Sidebar Menu -->
<ul class="sidebar-menu" data-widget="tree">
<ul class="sidebar-menu tree" data-widget="tree">
<li class="header">{{ trans('general.user-center') }}</li>
{!! bs_menu('user') !!}