mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-23 02:09:03 +02:00
Added an parameter to decide, if the root tree node should be expanded or not
Related to issue #158, but it does not work due to a very buggy treeview...
This commit is contained in:
parent
cb16819340
commit
e7fa1ebcb8
5 changed files with 17 additions and 5 deletions
|
@ -64,14 +64,18 @@ class TreeViewGenerator
|
|||
protected $keyGenerator;
|
||||
protected $translator;
|
||||
|
||||
protected $rootNodeExpandedByDefault;
|
||||
|
||||
public function __construct(EntityURLGenerator $URLGenerator, EntityManagerInterface $em,
|
||||
TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, TranslatorInterface $translator)
|
||||
TagAwareCacheInterface $treeCache, UserCacheKeyGenerator $keyGenerator, TranslatorInterface $translator, bool $rootNodeExpandedByDefault)
|
||||
{
|
||||
$this->urlGenerator = $URLGenerator;
|
||||
$this->em = $em;
|
||||
$this->cache = $treeCache;
|
||||
$this->keyGenerator = $keyGenerator;
|
||||
$this->translator = $translator;
|
||||
|
||||
$this->rootNodeExpandedByDefault = $rootNodeExpandedByDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,7 +146,7 @@ class TreeViewGenerator
|
|||
|
||||
if ($mode === 'list_parts_root' ||$mode === 'devices') {
|
||||
$root_node = new TreeViewNode($this->translator->trans('tree.root_node.text'), null, $generic);
|
||||
$root_node->setExpanded(true);
|
||||
$root_node->setExpanded($this->rootNodeExpandedByDefault);
|
||||
$generic = [$root_node];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue