mirror of
https://github.com/prurigro/hypothetical.git
synced 2024-12-22 17:50:22 -05:00
Move the dashboard menu functionality to app/Models/DashboardMenu.php and allow for dropdown items
This commit is contained in:
parent
b1533bb233
commit
b55e0096c8
5 changed files with 66 additions and 10 deletions
16
app/Models/DashboardMenu.php
Normal file
16
app/Models/DashboardMenu.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
class DashboardMenu
|
||||
{
|
||||
/**
|
||||
* Dashboard Menu
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static $menu = [
|
||||
[ 'Contact', 'contact' ],
|
||||
[ 'Subscriptions', 'subscriptions' ]
|
||||
];
|
||||
}
|
17
readme.md
17
readme.md
|
@ -256,13 +256,20 @@ When a row is deleted, its respective image will be deleted as well if it exists
|
|||
|
||||
### Adding to the Dashboard Menu
|
||||
|
||||
Add an array to the menu array in `resources/views/dashboard/elements/menu.blade.php` where the visible title as the first item and the model name as the second:
|
||||
Edit the `$menu` array in `app/Models/DashboardMenu.php` where the first column of each item is the title and the second is either a path, or an array of submenu items.
|
||||
|
||||
```php
|
||||
@set('menu', [
|
||||
[ 'Page Name', 'model_name' ],
|
||||
[ 'Contact', 'contact' ]
|
||||
])
|
||||
public static $menu = [
|
||||
[ 'Contact', 'contact' ],
|
||||
[ 'Subscriptions', 'subscriptions' ],
|
||||
|
||||
[
|
||||
'Projects', [
|
||||
[ 'Residential', 'projects-residential' ],
|
||||
[ 'Commercial', 'projects-commercial' ]
|
||||
]
|
||||
]
|
||||
];
|
||||
```
|
||||
|
||||
#### Additional Requirement for Delete Functionality
|
||||
|
|
1
resources/assets/sass/dashboard.scss
vendored
1
resources/assets/sass/dashboard.scss
vendored
|
@ -98,7 +98,6 @@ body {
|
|||
margin-bottom: 40px;
|
||||
|
||||
.panel-body {
|
||||
padding-bottom: 0px;
|
||||
background-color: lighten($c-dashboard-light, 1%);
|
||||
|
||||
@media (max-width: $screen-xs-max) {
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
@extends('dashboard.core')
|
||||
|
||||
@section('dashboard-body')
|
||||
@set('menu_class', 'list-group-item')
|
||||
<ul class="list-group linked-list">@include('dashboard.sections.menu')</ul>
|
||||
@foreach(App\Models\DashboardMenu::$menu as $menu_item)
|
||||
@if(is_array($menu_item[1]))
|
||||
@foreach($menu_item[1] as $submenu_item)
|
||||
<li class="list-group-item">
|
||||
<a href="{{ url('/dashboard/' . $submenu_item[1]) }}">
|
||||
{{ $menu_item[0] }}: {{ $submenu_item[0] }}
|
||||
</a>
|
||||
</li>
|
||||
@endforeach
|
||||
@else
|
||||
<li class="list-group-item">
|
||||
<a href="{{ url('/dashboard/' . $menu_item[1]) }}">
|
||||
{{ $menu_item[0] }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
@endsection
|
||||
|
|
|
@ -22,8 +22,27 @@
|
|||
<li><a href="{{ url('/register') }}">Register</a></li>
|
||||
@endif
|
||||
@else
|
||||
@set('menu_class', 'nav-item')
|
||||
@include('dashboard.sections.menu')
|
||||
@foreach(App\Models\DashboardMenu::$menu as $menu_item)
|
||||
@if(is_array($menu_item[1]))
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
{{ $menu_item[0] }} <span class="caret"></span>
|
||||
</a>
|
||||
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
@foreach($menu_item[1] as $submenu_item)
|
||||
<li><a href="{{ url('/dashboard/' . $submenu_item[1]) }}">{{ $submenu_item[0] }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</li>
|
||||
@else
|
||||
<li class="nav-item">
|
||||
<a href="{{ url('/dashboard/' . $menu_item[1]) }}">
|
||||
{{ $menu_item[0] }}
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
|
|
Loading…
Reference in a new issue