chg: [layout:breadcrumb] Support of icon in breadcrumb
parent
83bc9732e7
commit
0da5d456d1
|
@ -13,6 +13,20 @@ class NavigationComponent extends Component
|
|||
{
|
||||
private $user = 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
|
||||
{
|
||||
|
@ -250,8 +264,8 @@ class NavigationComponent extends Component
|
|||
'routes' => [
|
||||
"{$controller}:index" => [
|
||||
'label' => Inflector::humanize($controller),
|
||||
'icon' => 'network-wired',
|
||||
'url' => "/{$controller}/index",
|
||||
'icon' => $this->iconToTableMapping[$controller]
|
||||
],
|
||||
"{$controller}:view" => [
|
||||
'label' => __('View'),
|
||||
|
@ -289,6 +303,7 @@ class NavigationComponent extends Component
|
|||
'defaults' => ['depth-1' => ['links' => 'LocalTools:brood_tools']]
|
||||
]),
|
||||
'Roles' => $this->getDefaultCRUDConfig('Roles'),
|
||||
'Users' => $this->getDefaultCRUDConfig('Users'),
|
||||
'Inbox' => $this->getDefaultCRUDConfig('Inbox', [
|
||||
'defaults' => ['depth-1' => [
|
||||
'links' => ['Inbox:view', 'Inbox:process'],
|
||||
|
@ -350,20 +365,18 @@ class NavigationComponent extends Component
|
|||
'routes' => [
|
||||
'LocalTools:index' => [
|
||||
'label' => __('Local Tools'),
|
||||
'icon' => 'tools',
|
||||
'url' => '/localTools/index',
|
||||
'icon' => $this->iconToTableMapping['LocalTools'],
|
||||
],
|
||||
'LocalTools:viewConnector' => [
|
||||
'label' => __('View'),
|
||||
'textGetter' => 'name',
|
||||
'icon' => 'tools',
|
||||
'url' => '/localTools/viewConnector/{{connector}}',
|
||||
'url_vars' => ['connector' => 'connector'],
|
||||
'after' => 'LocalTools:index',
|
||||
],
|
||||
'LocalTools:broodTools' => [
|
||||
'label' => __('Brood Tools'),
|
||||
'icon' => 'tools',
|
||||
'url' => '/localTools/broodTools/{{id}}',
|
||||
'url_vars' => ['id' => 'id'],
|
||||
],
|
||||
|
@ -373,8 +386,8 @@ class NavigationComponent extends Component
|
|||
'routes' => [
|
||||
'Instance:migrationIndex' => [
|
||||
'label' => __('Database Migration'),
|
||||
'icon' => 'database',
|
||||
'url' => '/instance/migrationIndex',
|
||||
'icon' => 'database'
|
||||
]
|
||||
]
|
||||
]
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
'<nav class="header-breadcrumb d-xl-block d-none"{{attrs}}><ol class="">{{content}}</ol></nav>'
|
||||
),
|
||||
'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'
|
||||
),
|
||||
'itemWithoutLink' => '<li class="header-breadcrumb-item"{{attrs}}><span{{innerAttrs}}>{{title}}</span></li>{{separator}}',
|
||||
|
@ -30,7 +30,12 @@
|
|||
if (!empty($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];
|
||||
|
|
Loading…
Reference in New Issue