diff --git a/app/helpers.php b/app/helpers.php index 8f8a0ce3..c877177a 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -151,7 +151,16 @@ if (! function_exists('bs_menu')) { $content = ""; foreach ($data as $key => $value) { - $content .= (app('request')->is(@$value['link'])) ? '
  • ' : '
  • '; + $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 ? '
  • ' : '
  • '; if (isset($value['children'])) { $content .= ' '.trans($value['title']).''; diff --git a/resources/assets/src/js/general.js b/resources/assets/src/js/general.js index d5ef63e1..549f9bbc 100644 --- a/resources/assets/src/js/general.js +++ b/resources/assets/src/js/general.js @@ -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(); +});