Added show all parts to tools tree.

This commit is contained in:
Jan Böhmer 2019-03-26 15:57:51 +01:00
parent c0f44b76f3
commit 570aa68535
2 changed files with 20 additions and 1 deletions

View file

@ -67,7 +67,7 @@ class PartListsController extends AbstractController
}
/**
* @Route("/parts")
* @Route("/parts", name="parts_show_all")
*
* @param Request $request
* @param DataTableFactory $dataTable

View file

@ -30,6 +30,8 @@
namespace App\Services;
use App\Helpers\TreeViewNode;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* This Service generates the tree structure for the tools.
@ -38,6 +40,16 @@ use App\Helpers\TreeViewNode;
class ToolsTreeBuilder
{
protected $translator;
protected $urlGenerator;
public function __construct(TranslatorInterface $translator, UrlGeneratorInterface $urlGenerator)
{
$this->translator = $translator;
$this->urlGenerator = $urlGenerator;
}
/**
* Generates the tree for the tools menu.
* @return TreeViewNode The array containing all Nodes for the tools menu.
@ -52,6 +64,13 @@ class ToolsTreeBuilder
$tree[] = new TreeViewNode('test', 'www.google.de', $nodes);
$show_nodes = array();
$show_nodes[] = new TreeViewNode($this->translator->trans('tree.tools.show.all_parts'),
$this->urlGenerator->generate('parts_show_all')
);
$tree[] = new TreeViewNode($this->translator->trans('tree.tools.show'), null, $show_nodes);
return $tree;
}
}