From 6c899b7b61bfd8d2c97f8aa077aaa3df45b48195 Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Fri, 17 Sep 2021 21:51:55 +0100 Subject: [PATCH] [Plugins][Components] Fixed issue where right panel form was rendered multiple times in actors plugin page. Actors page done. --- components/Avatar/Avatar.php | 2 +- components/Posting/Posting.php | 2 +- components/Right/Right.php | 3 +- .../templates/directory/actor.html.twig | 57 +++++++++---------- .../templates/directory/actors.html.twig | 6 +- templates/sidepanel/right/right.html.twig | 2 +- 6 files changed, 35 insertions(+), 37 deletions(-) diff --git a/components/Avatar/Avatar.php b/components/Avatar/Avatar.php index c58060cca2..70fa877dc4 100644 --- a/components/Avatar/Avatar.php +++ b/components/Avatar/Avatar.php @@ -57,7 +57,7 @@ class Avatar extends Component public function onStartTwigPopulateVars(array &$vars): bool { - if (Common::user() != null) { + if (Common::user() !== null) { $vars['user_avatar'] = self::getAvatarUrl(); } return Event::next; diff --git a/components/Posting/Posting.php b/components/Posting/Posting.php index 8976f0b384..19050c7d39 100644 --- a/components/Posting/Posting.php +++ b/components/Posting/Posting.php @@ -53,7 +53,7 @@ class Posting extends Component */ public function onStartTwigPopulateVars(array &$vars): bool { - if (($user = Common::user()) == null) { + if (($user = Common::user()) === null) { return Event::next; } diff --git a/components/Right/Right.php b/components/Right/Right.php index 62ddce268b..c4d2c6fc0b 100644 --- a/components/Right/Right.php +++ b/components/Right/Right.php @@ -21,10 +21,11 @@ namespace Component\Right; use App\Core\Event; use App\Core\Modules\Component; +use App\Util\Common; class Right extends Component { - public function onEndTwigPopulateVars(array &$vars) + public function onStartTwigPopulateVars(array &$vars) { return Event::next; } diff --git a/plugins/Directory/templates/directory/actor.html.twig b/plugins/Directory/templates/directory/actor.html.twig index e7f564c569..1cd19c5251 100644 --- a/plugins/Directory/templates/directory/actor.html.twig +++ b/plugins/Directory/templates/directory/actor.html.twig @@ -1,37 +1,32 @@ -{% extends 'stdgrid.html.twig' %} - -{% set nickname = note.getActorNickname() %} - -{% block title %}{{ nickname }}'s profile{% endblock %} +{% set actor_nickname = actor.nickname() %} +{% set actor_tags = actor.getSelfTags() %} +{% set actor_bio = actor.getBio() %} {% block body %} -
-
- {{ nickname }}'s avatar{{ nickname }} -
+
+ + {{ 'Your account\'s avatar.' | trans }} + +
{% endblock body %} \ No newline at end of file diff --git a/plugins/Directory/templates/directory/actors.html.twig b/plugins/Directory/templates/directory/actors.html.twig index de1705d82f..bd06ebbd41 100644 --- a/plugins/Directory/templates/directory/actors.html.twig +++ b/plugins/Directory/templates/directory/actors.html.twig @@ -4,10 +4,12 @@ {% block body %}
-
+

{{ "Actors" | trans }}

+ +
{% if actors is defined and actors is not empty %} {% for actor in actors %} - {% include 'directory/actor.html.twig' with {'actor': actor, 'have_user': have_user} only %} + {% include 'directory/actor.html.twig' %} {% endfor %} {% else %}

{% trans %}No actors here.{% endtrans %}

diff --git a/templates/sidepanel/right/right.html.twig b/templates/sidepanel/right/right.html.twig index c84885e369..a2ff347d3b 100644 --- a/templates/sidepanel/right/right.html.twig +++ b/templates/sidepanel/right/right.html.twig @@ -5,7 +5,7 @@