chg: [layout:breadcrumb] Support of icon in breadcrumb
parent
83bc9732e7
commit
0da5d456d1
|
@ -13,6 +13,20 @@ class NavigationComponent extends Component
|
||||||
{
|
{
|
||||||
private $user = null;
|
private $user = null;
|
||||||
public $breadcrumb = null;
|
public $breadcrumb = null;
|
||||||
|
public $iconToTableMapping = [
|
||||||
|
'Individuals' => 'address-book',
|
||||||
|
'Organisations' => 'building',
|
||||||
|
'EncryptionKeys' => 'key',
|
||||||
|
'SharingGroups' => 'user-friends',
|
||||||
|
'Broods' => 'network-wired',
|
||||||
|
'Roles' => 'id-badge',
|
||||||
|
'Users' => 'users',
|
||||||
|
'Inbox' => 'inbox',
|
||||||
|
'Outbox' => 'inbox',
|
||||||
|
'MetaTemplates' => 'object-group',
|
||||||
|
'LocalTools' => 'tools',
|
||||||
|
'Instance' => 'server',
|
||||||
|
];
|
||||||
|
|
||||||
public function initialize(array $config): void
|
public function initialize(array $config): void
|
||||||
{
|
{
|
||||||
|
@ -250,8 +264,8 @@ class NavigationComponent extends Component
|
||||||
'routes' => [
|
'routes' => [
|
||||||
"{$controller}:index" => [
|
"{$controller}:index" => [
|
||||||
'label' => Inflector::humanize($controller),
|
'label' => Inflector::humanize($controller),
|
||||||
'icon' => 'network-wired',
|
|
||||||
'url' => "/{$controller}/index",
|
'url' => "/{$controller}/index",
|
||||||
|
'icon' => $this->iconToTableMapping[$controller]
|
||||||
],
|
],
|
||||||
"{$controller}:view" => [
|
"{$controller}:view" => [
|
||||||
'label' => __('View'),
|
'label' => __('View'),
|
||||||
|
@ -289,6 +303,7 @@ class NavigationComponent extends Component
|
||||||
'defaults' => ['depth-1' => ['links' => 'LocalTools:brood_tools']]
|
'defaults' => ['depth-1' => ['links' => 'LocalTools:brood_tools']]
|
||||||
]),
|
]),
|
||||||
'Roles' => $this->getDefaultCRUDConfig('Roles'),
|
'Roles' => $this->getDefaultCRUDConfig('Roles'),
|
||||||
|
'Users' => $this->getDefaultCRUDConfig('Users'),
|
||||||
'Inbox' => $this->getDefaultCRUDConfig('Inbox', [
|
'Inbox' => $this->getDefaultCRUDConfig('Inbox', [
|
||||||
'defaults' => ['depth-1' => [
|
'defaults' => ['depth-1' => [
|
||||||
'links' => ['Inbox:view', 'Inbox:process'],
|
'links' => ['Inbox:view', 'Inbox:process'],
|
||||||
|
@ -350,20 +365,18 @@ class NavigationComponent extends Component
|
||||||
'routes' => [
|
'routes' => [
|
||||||
'LocalTools:index' => [
|
'LocalTools:index' => [
|
||||||
'label' => __('Local Tools'),
|
'label' => __('Local Tools'),
|
||||||
'icon' => 'tools',
|
|
||||||
'url' => '/localTools/index',
|
'url' => '/localTools/index',
|
||||||
|
'icon' => $this->iconToTableMapping['LocalTools'],
|
||||||
],
|
],
|
||||||
'LocalTools:viewConnector' => [
|
'LocalTools:viewConnector' => [
|
||||||
'label' => __('View'),
|
'label' => __('View'),
|
||||||
'textGetter' => 'name',
|
'textGetter' => 'name',
|
||||||
'icon' => 'tools',
|
|
||||||
'url' => '/localTools/viewConnector/{{connector}}',
|
'url' => '/localTools/viewConnector/{{connector}}',
|
||||||
'url_vars' => ['connector' => 'connector'],
|
'url_vars' => ['connector' => 'connector'],
|
||||||
'after' => 'LocalTools:index',
|
'after' => 'LocalTools:index',
|
||||||
],
|
],
|
||||||
'LocalTools:broodTools' => [
|
'LocalTools:broodTools' => [
|
||||||
'label' => __('Brood Tools'),
|
'label' => __('Brood Tools'),
|
||||||
'icon' => 'tools',
|
|
||||||
'url' => '/localTools/broodTools/{{id}}',
|
'url' => '/localTools/broodTools/{{id}}',
|
||||||
'url_vars' => ['id' => 'id'],
|
'url_vars' => ['id' => 'id'],
|
||||||
],
|
],
|
||||||
|
@ -373,8 +386,8 @@ class NavigationComponent extends Component
|
||||||
'routes' => [
|
'routes' => [
|
||||||
'Instance:migrationIndex' => [
|
'Instance:migrationIndex' => [
|
||||||
'label' => __('Database Migration'),
|
'label' => __('Database Migration'),
|
||||||
'icon' => 'database',
|
|
||||||
'url' => '/instance/migrationIndex',
|
'url' => '/instance/migrationIndex',
|
||||||
|
'icon' => 'database'
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
'<nav class="header-breadcrumb d-xl-block d-none"{{attrs}}><ol class="">{{content}}</ol></nav>'
|
'<nav class="header-breadcrumb d-xl-block d-none"{{attrs}}><ol class="">{{content}}</ol></nav>'
|
||||||
),
|
),
|
||||||
'item' => sprintf(
|
'item' => sprintf(
|
||||||
'<li class="header-breadcrumb-item"{{attrs}}><a href="{{url}}"{{innerAttrs}}>{{title}}</a></li>{{separator}}',
|
'<li class="header-breadcrumb-item"{{attrs}}><i class="{{icon}} mr-1"></i><a href="{{url}}"{{innerAttrs}}>{{title}}</a></li>{{separator}}',
|
||||||
empty($darkMode) ? 'light' : 'dark'
|
empty($darkMode) ? 'light' : 'dark'
|
||||||
),
|
),
|
||||||
'itemWithoutLink' => '<li class="header-breadcrumb-item"{{attrs}}><span{{innerAttrs}}>{{title}}</span></li>{{separator}}',
|
'itemWithoutLink' => '<li class="header-breadcrumb-item"{{attrs}}><span{{innerAttrs}}>{{title}}</span></li>{{separator}}',
|
||||||
|
@ -30,7 +30,12 @@
|
||||||
if (!empty($entry['url_vars'])) {
|
if (!empty($entry['url_vars'])) {
|
||||||
$entry['url'] = $this->DataFromPath->buildStringFromDataPath($entry['url'], $entity, $entry['url_vars']);
|
$entry['url'] = $this->DataFromPath->buildStringFromDataPath($entry['url'], $entity, $entry['url_vars']);
|
||||||
}
|
}
|
||||||
$this->Breadcrumbs->add(h($entry['label']), Router::url($entry['url']), ['title' => h($entry['label'])]);
|
$this->Breadcrumbs->add(h($entry['label']), Router::url($entry['url']), [
|
||||||
|
'title' => h($entry['label']),
|
||||||
|
'templateVars' => [
|
||||||
|
'icon' => !empty($entry['icon']) ? $this->FontAwesome->getClass(h($entry['icon'])) : ''
|
||||||
|
]
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastCrumb = $breadcrumb[count($breadcrumb)-1];
|
$lastCrumb = $breadcrumb[count($breadcrumb)-1];
|
||||||
|
|
Loading…
Reference in New Issue