Add a credits page to the dashboard showing the project authors and front-facing libraries used on the website, use /dashboard/edit for both the edit-list and edit-item pages, organize the dashboard styles a bit better, use relative paths instead of the url() function to render the dashboard URLs, add active nav link functionality to links other than the main dashboard pages, pull the nav blade out of the sections folder now that it's the only section, and keep the traditional template in sync

This commit is contained in:
Kevin MacMartin 2018-04-18 23:32:22 -04:00
parent 679ef84d55
commit 58902bb5ee
10 changed files with 225 additions and 130 deletions

View file

@ -11,9 +11,7 @@ use App\Models\Dashboard;
class DashboardController extends Controller {
/**
* Create a new controller instance.
*
* @return void
* Create a new controller instance
*/
public function __construct()
{
@ -21,17 +19,23 @@ class DashboardController extends Controller {
}
/**
* Show the application dashboard.
*
* @return Response
* Show the application dashboard
*/
public function index()
public function getIndex()
{
return view('dashboard.home', [
'heading' => 'Dashboard Home'
]);
}
/**
* Show the dashboard credits
*/
public function getCredits()
{
return view('dashboard.credits');
}
/**
* Dashboard View
*/

View file

@ -34,6 +34,35 @@ class Dashboard
]
];
/**
* Authors (Credits Page)
*
* @return array
*/
public static $author_credits = [
[ 'name' => 'Kevin MacMartin', 'url' => 'https://github.com/prurigro' ]
];
/**
* Libraries (Credits Page)
*
* @return array
*/
public static $library_credits = [
[ 'name' => 'Bootstrap', 'url' => 'https://getbootstrap.com' ],
[ 'name' => 'Font Awesome', 'url' => 'https://fontawesome.com' ],
[ 'name' => 'GreenSock', 'url' => 'https://greensock.com/gsap' ],
[ 'name' => 'jQuery', 'url' => 'https://jquery.org' ],
[ 'name' => 'List.js', 'url' => 'http://listjs.com' ],
[ 'name' => 'pickadate.js', 'url' => 'http://amsul.ca/pickadate.js/' ],
[ 'name' => 'Popper.js', 'url' => 'https://popper.js.org' ],
[ 'name' => 'SimpleMDE Markdown Editor', 'url' => 'https://simplemde.com' ],
[ 'name' => 'Sortable', 'url' => 'https://github.com/RubaXa/Sortable' ],
[ 'name' => 'SpinKit', 'url' => 'http://tobiasahlin.com/spinkit/' ],
[ 'name' => 'Vue.js', 'url' => 'https://vuejs.org' ],
[ 'name' => 'what-input', 'url' => 'https://github.com/ten1seven/what-input' ]
];
/**
* Retrieve a Dashboard Model
*

View file

@ -120,7 +120,7 @@ function editListInit() {
const $newButton = $(".btn.new-button");
$newButton.on("click", function() {
window.location.href = "/dashboard/edit-item/" + model + "/new";
window.location.href = "/dashboard/edit/" + model + "/new";
});
};
@ -134,7 +134,7 @@ function editListInit() {
itemId = $listItem.data("id");
// go to the edit page
window.location.href = "/dashboard/edit-item/" + model + "/" + itemId;
window.location.href = "/dashboard/edit/" + model + "/" + itemId;
});
};

View file

@ -149,37 +149,6 @@ body {
margin-top: 20px;
margin-bottom: 20px;
.card-body {
padding: 15px;
background-color: lighten($c-dashboard-light, 1%);
&.dashboard {
@include media-breakpoint-down(sm) {
padding: 0px;
}
}
.search {
margin-bottom: 10px;
width: 100%;
@include media-breakpoint-down(sm) {
margin: 3px 3px 0px 3px;
width: calc(100% - 6px);
}
}
.help-text {
margin-top: 10px;
margin-bottom: 10px;
padding: 5px 10px;
border: 1px solid darken($c-dashboard-dark, 5%);
border-radius: 5px;
background-color: $c-dashboard-dark;
color: $c-text-light;
}
}
> .card-header {
position: relative;
padding: 9px 15px;
@ -210,9 +179,38 @@ body {
}
}
}
.card-body {
padding: 15px;
background-color: lighten($c-dashboard-light, 1%);
&.dashboard {
@include media-breakpoint-down(sm) {
padding: 0px;
}
}
.card-body .form-group {
.search {
margin-bottom: 10px;
width: 100%;
@include media-breakpoint-down(sm) {
margin: 3px 3px 0px 3px;
width: calc(100% - 6px);
}
}
.help-text {
margin-top: 10px;
margin-bottom: 10px;
padding: 5px 10px;
border: 1px solid darken($c-dashboard-dark, 5%);
border-radius: 5px;
background-color: $c-dashboard-dark;
color: $c-text-light;
}
.form-group {
margin-bottom: 15px;
label {
@ -299,6 +297,32 @@ body {
}
}
.dashboard-credits {
padding: $grid-gutter-width;
h2 {
@include font-sans-semibold;
margin-bottom: 15px;
font-size: 18px;
text-transform: uppercase;
&:not(:first-child) {
margin-top: 25px;
}
}
ul {
margin-bottom: 0px;
padding-left: 20px;
li a {
color: $c-text;
}
}
}
}
}
.btn {
border-color: darken($c-dashboard-dark, 5%);
background-color: $c-dashboard-dark;

View file

@ -0,0 +1,35 @@
@extends('templates.dashboard')
@section('page-content')
<div class="container spark-screen">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
Credits
</div>
<div class="card-body dashboard">
<div class="dashboard-credits">
<h2>Authors</h2>
<ul>
@foreach(App\Models\Dashboard::$author_credits as $credit)
<li><a href="{{ $credit['url'] }}" target="_blank" rel="noreferrer">{{ $credit['name'] }}</a></li>
@endforeach
</ul>
<h2>Libraries</h2>
<ul>
@foreach(App\Models\Dashboard::$library_credits as $credit)
<li><a href="{{ $credit['url'] }}" target="_blank" rel="noreferrer">{{ $credit['name'] }}</a></li>
@endforeach
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection

View file

@ -10,7 +10,7 @@
<a
class="list-group-item-link"
href="{{ url('/dashboard/' . $submenu_item['type'] . '/' . $submenu_item['model']) }}">
href="/dashboard/{{ $submenu_item['type'] }}/{{ $submenu_item['model'] }}">
</a>
</li>
@endforeach
@ -20,7 +20,7 @@
<a
class="list-group-item-link"
href="{{ url('/dashboard/' . $menu_item['type'] . '/' . $menu_item['model']) }}">
href="/dashboard/{{ $menu_item['type'] }}/{{ $menu_item['model'] }}">
</a>
</li>
@endif

View file

@ -1,7 +1,7 @@
<nav class="navbar navbar-expand-lg">
@set('current_page', preg_replace([ '/^.*\//', '/\/.*/' ], [ '', '' ], Request::url()))
<a class="navbar-brand" href="{{ url('/dashboard') }}">
<a class="navbar-brand" href="/dashboard">
{{ env('APP_NAME') }} Dashboard
</a>
@ -16,10 +16,10 @@
<div id="dashboard-navbar" class="collapse navbar-collapse">
<ul class="navbar-nav ml-auto">
@if (Auth::guest())
<li class="nav-item"><a class="nav-link" href="{{ url('/login') }}">Login</a></li>
<li class="nav-item"><a class="nav-link {{ $current_page == 'login' ? 'active' : '' }}" href="/login">Login</a></li>
@if(env('REGISTRATION', false))
<li class="nav-item"><a class="nav-link" href="{{ url('/register') }}">Register</a></li>
<li class="nav-item"><a class="nav-link {{ $current_page == 'register' ? 'active' : '' }}" href="/register">Register</a></li>
@endif
@else
@foreach(App\Models\Dashboard::$menu as $menu_item)
@ -33,13 +33,13 @@
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="menu-dropdown-{{ $dropdown_id }}">
@foreach($menu_item['submenu'] as $submenu_item)
<a class="dropdown-item {{ $current_page == $submenu_item['model'] ? 'active' : '' }}" href="{{ url('/dashboard/' . $submenu_item['type'] . '/' . $submenu_item['model']) }}">{{ $submenu_item['title'] }}</a>
<a class="dropdown-item {{ $current_page == $submenu_item['model'] ? 'active' : '' }}" href="/dashboard/{{ $submenu_item['type'] }}/{{ $submenu_item['model'] }}">{{ $submenu_item['title'] }}</a>
@endforeach
</div>
</li>
@else
<li class="nav-item">
<a class="nav-link {{ $current_page == $menu_item['model'] ? 'active' : '' }}" href="{{ url('/dashboard/' . $menu_item['type'] . '/' . $menu_item['model']) }}">
<a class="nav-link {{ $current_page == $menu_item['model'] ? 'active' : '' }}" href="/dashboard/{{ $menu_item['type'] }}/{{ $menu_item['model'] }}">
{{ $menu_item['title'] }}
</a>
</li>
@ -52,7 +52,8 @@
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="user-dropdown">
<a class="dropdown-item" href="{{ url('/logout') }}">Logout</a>
<a class="dropdown-item {{ $current_page == 'credits' ? 'active' : '' }}" href="/dashboard/credits">Credits</a>
<a class="dropdown-item" href="/logout">Logout</a>
</div>
</li>
@endif

View file

@ -7,5 +7,5 @@
@endsection
@section('page-top')
@include('dashboard.sections.nav')
@include('dashboard.nav')
@endsection

View file

@ -29,10 +29,11 @@ Route::get('/logout', 'Auth\LoginController@logout');
*/
Route::group([ 'prefix' => 'dashboard' ], function() {
Route::get('/', 'DashboardController@index');
Route::get('/', 'DashboardController@getIndex');
Route::get('/credits', 'DashboardController@getCredits');
Route::get('/view/{model}', 'DashboardController@getView');
Route::get('/edit/{model}', 'DashboardController@getEditList');
Route::get('/edit-item/{model}/{id}', 'DashboardController@getEditItem');
Route::get('/edit/{model}/{id}', 'DashboardController@getEditItem');
Route::get('/export/{model}', 'DashboardController@getExport');
Route::post('/image-upload', 'DashboardController@postImageUpload');
Route::post('/file-upload', 'DashboardController@postFileUpload');

View file

@ -29,10 +29,11 @@ Route::get('/logout', 'Auth\LoginController@logout');
*/
Route::group([ 'prefix' => 'dashboard' ], function() {
Route::get('/', 'DashboardController@index');
Route::get('/', 'DashboardController@getIndex');
Route::get('/credits', 'DashboardController@getCredits');
Route::get('/view/{model}', 'DashboardController@getView');
Route::get('/edit/{model}', 'DashboardController@getEditList');
Route::get('/edit-item/{model}/{id}', 'DashboardController@getEditItem');
Route::get('/edit/{model}/{id}', 'DashboardController@getEditItem');
Route::get('/export/{model}', 'DashboardController@getExport');
Route::post('/image-upload', 'DashboardController@postImageUpload');
Route::post('/file-upload', 'DashboardController@postFileUpload');