[UI][TWIG] Small UI cleanup and change twig 'active' function to check for starts with, rather than equals

This commit is contained in:
Hugo Sales
2020-08-21 15:32:14 +00:00
committed by Hugo Sales
parent f2ab77c3a9
commit 38cfec8593
4 changed files with 5 additions and 7 deletions

View File

@@ -30,6 +30,7 @@
namespace App\Twig;
use App\Util\Formatting;
use Functional as F;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
@@ -52,7 +53,7 @@ class Runtime implements RuntimeExtensionInterface, EventSubscriberInterface
public function isCurrentRoute(string $class, string ...$routes): string
{
$current_route = $this->request->attributes->get('_route');
return F\some($routes, F\equal($current_route)) ? $class : '';
return F\some($routes, F\partial_left([Formatting::class, 'startsWith'], $current_route)) ? $class : '';
}
// ----------------------------------------------------------