mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 18:28:49 +02:00
Show icons in the root node in sidebar treeviews.
This commit is contained in:
parent
90da7d71b9
commit
18f41e14e6
4 changed files with 51 additions and 4 deletions
|
@ -156,6 +156,8 @@ class TreeViewGenerator
|
|||
if (($mode === 'list_parts_root' || $mode === 'devices') && $this->rootNodeEnabled) {
|
||||
$root_node = new TreeViewNode($this->entityClassToRootNodeString($class), null, $generic);
|
||||
$root_node->setExpanded($this->rootNodeExpandedByDefault);
|
||||
$root_node->setIcon($this->entityClassToRootNodeIcon($class));
|
||||
|
||||
$generic = [$root_node];
|
||||
}
|
||||
|
||||
|
@ -182,6 +184,27 @@ class TreeViewGenerator
|
|||
}
|
||||
}
|
||||
|
||||
protected function entityClassToRootNodeIcon(string $class): ?string
|
||||
{
|
||||
$icon = "fa-fw fa-treeview fa-solid ";
|
||||
switch ($class) {
|
||||
case Category::class:
|
||||
return $icon . 'fa-tags';
|
||||
case Storelocation::class:
|
||||
return $icon . 'fa-cube';
|
||||
case Footprint::class:
|
||||
return $icon . 'fa-microchip';
|
||||
case Manufacturer::class:
|
||||
return $icon . 'fa-industry';
|
||||
case Supplier::class:
|
||||
return $icon . 'fa-truck';
|
||||
case Device::class:
|
||||
return $icon . 'fa-archive';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* /**
|
||||
* Gets a tree of TreeViewNode elements. The root elements has $parent as parent.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue