From 9172e1b4058325864375040f23f8c295bb352587 Mon Sep 17 00:00:00 2001 From: mokaddem Date: Fri, 17 Sep 2021 15:44:52 +0200 Subject: [PATCH] chg: [layout:navbar] Moved links and actions breadcrumb items out of the main top navbar --- .../Component/NavigationComponent.php | 3 + .../layouts/header/header-breadcrumb.php | 36 +- templates/layout/default.php | 1 - webroot/css/layout.css | 14 +- webroot/css/theme-darkly.css | 78 + webroot/css/theme-default.css | 78 + webroot/css/theme-flatly.css | 78 + webroot/css/theme-minty.css | 78 + webroot/css/theme-quartz.css | 522 + webroot/css/theme-slate.css | 1155 ++ webroot/css/theme-vapor.css | 78 + webroot/css/themes/bootstrap4.4.1-default.css | 10224 ++++++++++++++++ webroot/css/themes/theme-darkly.css | 2 +- webroot/css/themes/theme-default.css | 4 +- webroot/css/themes/theme-flatly.css | 2 +- webroot/css/themes/theme-minty.css | 2 +- webroot/css/themes/theme-quartz.css | 2 +- webroot/css/themes/theme-slate.css | 2 +- webroot/css/themes/theme-vapor.css | 2 +- webroot/theme/package.json | 4 +- webroot/theme/scss/theme-default.scss | 9 +- 21 files changed, 12345 insertions(+), 29 deletions(-) create mode 100644 webroot/css/theme-darkly.css create mode 100644 webroot/css/theme-default.css create mode 100644 webroot/css/theme-flatly.css create mode 100644 webroot/css/theme-minty.css create mode 100644 webroot/css/theme-quartz.css create mode 100644 webroot/css/theme-slate.css create mode 100644 webroot/css/theme-vapor.css create mode 100644 webroot/css/themes/bootstrap4.4.1-default.css diff --git a/src/Controller/Component/NavigationComponent.php b/src/Controller/Component/NavigationComponent.php index 724ef53..8798531 100644 --- a/src/Controller/Component/NavigationComponent.php +++ b/src/Controller/Component/NavigationComponent.php @@ -269,18 +269,21 @@ class NavigationComponent extends Component ], "{$controller}:view" => [ 'label' => __('View'), + 'icon' => 'eye', 'inherit' => 'depth-1', 'url' => "/{$controller}/view/{{id}}", 'url_vars' => ['id' => 'id'], ], "{$controller}:edit" => [ 'label' => __('Edit'), + 'icon' => 'edit', 'inherit' => 'depth-1', 'url' => "/{$controller}/edit/{{id}}", 'url_vars' => ['id' => 'id'], ], "{$controller}:delete" => [ 'label' => __('Delete'), + 'icon' => 'trash', 'inherit' => 'depth-1', 'url' => "/{$controller}/delete/{{id}}", 'url_vars' => ['id' => 'id'], diff --git a/templates/element/layouts/header/header-breadcrumb.php b/templates/element/layouts/header/header-breadcrumb.php index d5562f5..6150221 100644 --- a/templates/element/layouts/header/header-breadcrumb.php +++ b/templates/element/layouts/header/header-breadcrumb.php @@ -29,16 +29,13 @@ 'title' => h($entry['label']), 'templateVars' => [ 'linkClass' => $i == 0 ? 'fw-light' : '', - 'icon' => !empty($entry['icon']) ? $this->FontAwesome->getClass(h($entry['icon'])) : '' + 'icon' => ($i == 0 && !empty($entry['icon'])) ? $this->FontAwesome->getClass(h($entry['icon'])) : '' ] ]); } $lastCrumb = $breadcrumb[count($breadcrumb)-1]; - if (!empty($lastCrumb['links']) || !empty($lastCrumb['actions'])) { - $this->Breadcrumbs->add([[]]); // add last separetor - } - + if (!empty($lastCrumb['links'])) { foreach ($lastCrumb['links'] as $i => $linkEntry) { $active = $linkEntry['route_path'] == $lastCrumb['route_path']; @@ -46,7 +43,7 @@ $linkEntry['url'] = $this->DataFromPath->buildStringFromDataPath($linkEntry['url'], $entity, $linkEntry['url_vars']); } $breadcrumbLinks .= sprintf('%s', - $active ? 'secondary' : 'dark', + $active ? 'secondary' : 'outline-secondary', Router::url($linkEntry['url']), h($linkEntry['label']) ); @@ -57,7 +54,11 @@ if (!empty($actionEntry['url_vars'])) { $actionEntry['url'] = $this->DataFromPath->buildStringFromDataPath($actionEntry['url'], $entity, $actionEntry['url_vars']); } - $breadcrumbAction .= sprintf('%s', Router::url($actionEntry['url']), h($actionEntry['label'])); + $breadcrumbAction .= sprintf('%s', + Router::url($actionEntry['url']), + !empty($entry['icon']) ? $this->FontAwesome->getClass(h($actionEntry['icon'])) : '', + h($actionEntry['label']) + ); } } } @@ -70,19 +71,34 @@ ['separator' => ''] ); ?> + + +