From 58902bb5eef9dbd1a5446ecc45f645cd821a790b Mon Sep 17 00:00:00 2001 From: Kevin MacMartin Date: Wed, 18 Apr 2018 23:32:22 -0400 Subject: [PATCH] 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 --- app/Http/Controllers/DashboardController.php | 18 +- app/Models/Dashboard.php | 29 +++ resources/assets/js/dashboard.js | 4 +- resources/assets/sass/dashboard.scss | 240 ++++++++++-------- resources/views/dashboard/credits.blade.php | 35 +++ resources/views/dashboard/home.blade.php | 4 +- .../dashboard/{sections => }/nav.blade.php | 13 +- resources/views/templates/dashboard.blade.php | 2 +- routes/web.php | 5 +- traditional-bootstrap/routes/web.php | 5 +- 10 files changed, 225 insertions(+), 130 deletions(-) create mode 100644 resources/views/dashboard/credits.blade.php rename resources/views/dashboard/{sections => }/nav.blade.php (78%) diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index b7a6258..ad2bb6b 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -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 */ diff --git a/app/Models/Dashboard.php b/app/Models/Dashboard.php index ebd6940..e403075 100644 --- a/app/Models/Dashboard.php +++ b/app/Models/Dashboard.php @@ -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 * diff --git a/resources/assets/js/dashboard.js b/resources/assets/js/dashboard.js index ce36fbb..d15ef84 100644 --- a/resources/assets/js/dashboard.js +++ b/resources/assets/js/dashboard.js @@ -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; }); }; diff --git a/resources/assets/sass/dashboard.scss b/resources/assets/sass/dashboard.scss index e150305..7285120 100644 --- a/resources/assets/sass/dashboard.scss +++ b/resources/assets/sass/dashboard.scss @@ -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,92 +179,147 @@ body { } } } -} -.card-body .form-group { - margin-bottom: 15px; + .card-body { + padding: 15px; + background-color: lighten($c-dashboard-light, 1%); - label { - @include font-sans-semibold; - font-size: 14px; - - @include media-breakpoint-up(md) { - text-align: right; - } - } - - .form-control { - font-size: 14px; - transition: border-color 150ms, box-shadow 150ms; - - &:focus { - border-color: $c-dashboard-dark; - box-shadow: inset 0 1px 1px fade-out(#000, 0.925), 0 0 8px fade-out($c-dashboard-dark, 0.4); - } - } - - &.has-error .form-control { - border-color: $c-dashboard-error; - } - - .checkbox { - position: relative; - display: inline-block; - min-height: 0px; - padding-top: 0px; - padding-left: 22px; - user-select: none; - - span, input { - position: absolute; - top: 50%; - left: 0px; - transform: translateY(-50%); - display: block; - width: 16px; - height: 16px; - } - - span { - border: 1px solid lighten($c-text, 50%); - border-radius: 4px; - background-color: $c-input-bg; - pointer-events: none; - - &:after { - content: ""; - position: absolute; - top: 0px; - left: 0px; - transform: scale(0); - display: block; - width: 100%; - height: 100%; - background-image: url("/img/dashboard/checkmark.svg"); - background-position: center center; - background-size: 65% auto; - background-repeat: no-repeat; - opacity: 0; - transition: transform 150ms, opacity 150ms; + &.dashboard { + @include media-breakpoint-down(sm) { + padding: 0px; } } - input { - margin: 0px; - padding: 0px; - opacity: 0; - cursor: pointer; + .search { + margin-bottom: 10px; + width: 100%; - &:checked + span:after { - transform: scale(1); - opacity: 1; + @include media-breakpoint-down(sm) { + margin: 3px 3px 0px 3px; + width: calc(100% - 6px); } } - } - .text-muted { - font-size: 10px; - text-transform: uppercase; + .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 { + @include font-sans-semibold; + font-size: 14px; + + @include media-breakpoint-up(md) { + text-align: right; + } + } + + .form-control { + font-size: 14px; + transition: border-color 150ms, box-shadow 150ms; + + &:focus { + border-color: $c-dashboard-dark; + box-shadow: inset 0 1px 1px fade-out(#000, 0.925), 0 0 8px fade-out($c-dashboard-dark, 0.4); + } + } + + &.has-error .form-control { + border-color: $c-dashboard-error; + } + + .checkbox { + position: relative; + display: inline-block; + min-height: 0px; + padding-top: 0px; + padding-left: 22px; + user-select: none; + + span, input { + position: absolute; + top: 50%; + left: 0px; + transform: translateY(-50%); + display: block; + width: 16px; + height: 16px; + } + + span { + border: 1px solid lighten($c-text, 50%); + border-radius: 4px; + background-color: $c-input-bg; + pointer-events: none; + + &:after { + content: ""; + position: absolute; + top: 0px; + left: 0px; + transform: scale(0); + display: block; + width: 100%; + height: 100%; + background-image: url("/img/dashboard/checkmark.svg"); + background-position: center center; + background-size: 65% auto; + background-repeat: no-repeat; + opacity: 0; + transition: transform 150ms, opacity 150ms; + } + } + + input { + margin: 0px; + padding: 0px; + opacity: 0; + cursor: pointer; + + &:checked + span:after { + transform: scale(1); + opacity: 1; + } + } + } + + .text-muted { + font-size: 10px; + text-transform: uppercase; + } + } + + .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; + } + } + } } } diff --git a/resources/views/dashboard/credits.blade.php b/resources/views/dashboard/credits.blade.php new file mode 100644 index 0000000..607f7b5 --- /dev/null +++ b/resources/views/dashboard/credits.blade.php @@ -0,0 +1,35 @@ +@extends('templates.dashboard') + +@section('page-content') +
+
+
+
+
+ Credits +
+ +
+
+

Authors

+ + + +

Libraries

+ + +
+
+
+
+
+
+@endsection diff --git a/resources/views/dashboard/home.blade.php b/resources/views/dashboard/home.blade.php index 546cd3b..417a1f4 100644 --- a/resources/views/dashboard/home.blade.php +++ b/resources/views/dashboard/home.blade.php @@ -10,7 +10,7 @@ + href="/dashboard/{{ $submenu_item['type'] }}/{{ $submenu_item['model'] }}"> @endforeach @@ -20,7 +20,7 @@ + href="/dashboard/{{ $menu_item['type'] }}/{{ $menu_item['model'] }}"> @endif diff --git a/resources/views/dashboard/sections/nav.blade.php b/resources/views/dashboard/nav.blade.php similarity index 78% rename from resources/views/dashboard/sections/nav.blade.php rename to resources/views/dashboard/nav.blade.php index 39eccbd..db4c2c8 100644 --- a/resources/views/dashboard/sections/nav.blade.php +++ b/resources/views/dashboard/nav.blade.php @@ -1,7 +1,7 @@