Fix active nav link logic

This commit is contained in:
Kevin MacMartin 2018-04-18 00:47:14 -04:00
parent 0fe1549dac
commit 7f9b0ef09a
2 changed files with 3 additions and 3 deletions

View file

@ -137,7 +137,7 @@ body {
padding-left: 8px;
}
&:hover, &:focus, &:active {
&.active, &:hover, &:focus, &:active {
background-color: fade-out(#000, 0.95);
color: $c-text;
}

View file

@ -1,5 +1,5 @@
<nav class="navbar navbar-expand-lg">
@set('current_page', preg_replace([ '/^.*\/dashboard\/?/', '/\/.*/' ], [ '', '' ], Request::url()))
@set('current_page', preg_replace([ '/^.*\//', '/\/.*/' ], [ '', '' ], Request::url()))
<a class="navbar-brand" href="{{ url('/dashboard') }}">
{{ env('APP_NAME') }} Dashboard
@ -33,7 +33,7 @@
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="menu-dropdown-{{ $dropdown_id }}">
@foreach($menu_item['submenu'] as $submenu_item)
<a class="dropdown-item" href="{{ url('/dashboard/' . $submenu_item['type'] . '/' . $submenu_item['model']) }}">{{ $submenu_item['title'] }}</a>
<a class="dropdown-item {{ $current_page == $submenu_item['model'] ? 'active' : '' }}" href="{{ url('/dashboard/' . $submenu_item['type'] . '/' . $submenu_item['model']) }}">{{ $submenu_item['title'] }}</a>
@endforeach
</div>
</li>