From 38cfec8593e372daafee9aec39338cdee41e1e11 Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Fri, 21 Aug 2020 15:32:14 +0000 Subject: [PATCH] [UI][TWIG] Small UI cleanup and change twig 'active' function to check for starts with, rather than equals --- src/Controller/NetworkPublic.php | 3 --- src/Twig/Runtime.php | 3 ++- templates/left/left.html.twig | 4 ++-- templates/network/public.html.twig | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Controller/NetworkPublic.php b/src/Controller/NetworkPublic.php index 8d27b3e13c..88783eb8fa 100644 --- a/src/Controller/NetworkPublic.php +++ b/src/Controller/NetworkPublic.php @@ -49,9 +49,6 @@ class NetworkPublic extends Controller ); $attachments[] = $a; } - if ($notes === []) { - $notes = null; - } return [ '_template' => 'network/public.html.twig', 'notes' => $notes, diff --git a/src/Twig/Runtime.php b/src/Twig/Runtime.php index 48b5c94d6e..6733170561 100644 --- a/src/Twig/Runtime.php +++ b/src/Twig/Runtime.php @@ -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 : ''; } // ---------------------------------------------------------- diff --git a/templates/left/left.html.twig b/templates/left/left.html.twig index c82be54b33..be8dc75cff 100644 --- a/templates/left/left.html.twig +++ b/templates/left/left.html.twig @@ -30,7 +30,7 @@ #{{ tag }} {% endfor %} {% else %} - {{ '(None)' | trans }} + {{ '(No tags)' | trans }} {% endif %}
@@ -46,7 +46,7 @@ Replies Favourites Reverse Favs - Settings + Settings Logout