mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-03-07 15:16:40 +08:00
enhance judgement of active menu
This commit is contained in:
parent
58014e9b1e
commit
2807c3ce6d
@ -151,7 +151,16 @@ if (! function_exists('bs_menu')) {
|
||||
$content = "";
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$content .= (app('request')->is(@$value['link'])) ? '<li class="active">' : '<li>';
|
||||
$active = app('request')->is(@$value['link']);
|
||||
|
||||
// also set parent as active if any child is active
|
||||
foreach ((array) @$value['children'] as $childKey => $childValue) {
|
||||
if (app('request')->is(@$childValue['link'])) {
|
||||
$active = true;
|
||||
}
|
||||
}
|
||||
|
||||
$content .= $active ? '<li class="active">' : '<li>';
|
||||
|
||||
if (isset($value['children'])) {
|
||||
$content .= '<a href="#"><i class="fa '.$value['icon'].'"></i> <span>'.trans($value['title']).'</span><span class="pull-right-container"><i class="fa fa-angle-left pull-right"></i></span></a>';
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-09-15 10:39:41
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2016-12-10 21:57:23
|
||||
* @Last Modified time: 2016-12-17 18:47:02
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@ -44,3 +44,7 @@ function do_logout(callback) {
|
||||
error: showAjaxError
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('li.active > ul').show();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user