[Directory] Fixup directory plugin

This commit is contained in:
Hugo Sales 2021-04-15 16:57:39 +00:00
parent cc9f2d6ff2
commit 483ac38888
No known key found for this signature in database
GPG Key ID: 7D0C7EAFC9D835A0
2 changed files with 10 additions and 15 deletions

View File

@ -32,8 +32,9 @@ class Directory extends Module
*/ */
public function onAddRoute(RouteLoader $r) public function onAddRoute(RouteLoader $r)
{ {
$r->connect('actors', '/actors', [Controller\Directory::class, 'actors']); $r->connect('directory_actors', '/actors', [Controller\Directory::class, 'actors']);
$r->connect('groups', '/groups', [Controller\Directory::class, 'groups']); $r->connect('directory_groups', '/groups', [Controller\Directory::class, 'groups']);
return Event::next; return Event::next;
} }
@ -46,16 +47,8 @@ class Directory extends Module
*/ */
public function onStartTwigPopulateVars(array &$vars): bool public function onStartTwigPopulateVars(array &$vars): bool
{ {
$vars['main_nav_tabs'] = [ $vars['main_nav_tabs'][] = ['title' => 'Actors', 'route' => 'directory_actors'];
[ $vars['main_nav_tabs'][] = ['title' => 'Groups', 'route' => 'directory_groups'];
'title' => 'Actors',
'route' => 'actors',
],
[
'title' => 'Groups',
'route' => 'groups',
],
];
return Event::next; return Event::next;
} }

View File

@ -91,11 +91,13 @@
<li> <li>
<a href="{{ path('main_all') }}" class='hover-effect {{ active('main_all') }}'>Network</a> <a href="{{ path('main_all') }}" class='hover-effect {{ active('main_all') }}'>Network</a>
</li> </li>
{% if main_nav_tabs is defined %}
{% for tab in main_nav_tabs %} {% for tab in main_nav_tabs %}
<li> <li>
<a href="{{ path(tab['route']) }}" class='hover-effect {{ active(tab['route']) }}' >{{ tab['title'] }}</a> <a href="{{ path(tab['route']) }}" class='hover-effect {{ active(tab['route']) }}' >{{ tab['title'] }}</a>
</li> </li>
{% endfor %} {% endfor %}
{% endif %}
</ul> </ul>
</nav> </nav>
<div class="timeline"> <div class="timeline">