[Plugins][Components] Fixed issue where right panel form was rendered multiple times in actors plugin page. Actors page done.

This commit is contained in:
Eliseu Amaro 2021-09-17 21:51:55 +01:00 committed by Diogo Peralta Cordeiro
parent e4b650be46
commit 6c899b7b61
Signed by: diogo
GPG Key ID: 18D2D35001FBFAB0
6 changed files with 35 additions and 37 deletions

View File

@ -57,7 +57,7 @@ class Avatar extends Component
public function onStartTwigPopulateVars(array &$vars): bool public function onStartTwigPopulateVars(array &$vars): bool
{ {
if (Common::user() != null) { if (Common::user() !== null) {
$vars['user_avatar'] = self::getAvatarUrl(); $vars['user_avatar'] = self::getAvatarUrl();
} }
return Event::next; return Event::next;

View File

@ -53,7 +53,7 @@ class Posting extends Component
*/ */
public function onStartTwigPopulateVars(array &$vars): bool public function onStartTwigPopulateVars(array &$vars): bool
{ {
if (($user = Common::user()) == null) { if (($user = Common::user()) === null) {
return Event::next; return Event::next;
} }

View File

@ -21,10 +21,11 @@ namespace Component\Right;
use App\Core\Event; use App\Core\Event;
use App\Core\Modules\Component; use App\Core\Modules\Component;
use App\Util\Common;
class Right extends Component class Right extends Component
{ {
public function onEndTwigPopulateVars(array &$vars) public function onStartTwigPopulateVars(array &$vars)
{ {
return Event::next; return Event::next;
} }

View File

@ -1,37 +1,32 @@
{% extends 'stdgrid.html.twig' %} {% set actor_nickname = actor.nickname() %}
{% set actor_tags = actor.getSelfTags() %}
{% set nickname = note.getActorNickname() %} {% set actor_bio = actor.getBio() %}
{% block title %}{{ nickname }}'s profile{% endblock %}
{% block body %} {% block body %}
<section class="section-widget section-widget-padded"> <section class='section-widget section-widget-padded' title="{{ 'Your profile information.' | trans }}">
<div class="section-title"> <a id="user" href="{{ path('actor_view_nickname', {'nickname' : actor_nickname}) }}">
<img class="icon icon-avatar" src="{{ actor.getAvatarUrl() }}" alt="{{ nickname }}'s avatar">{{ nickname }} <img src='{{ user_avatar }}' class="icon icon-avatar" alt="{{ 'Your account\'s avatar.' | trans }}">
</div> <div class="user-info">
<strong id="user-nickname" title="{{ 'Your account\' nickname.' | trans }}">{{ actor_nickname }}</strong>
<div class="actor-nickname-and-tags"> <nav class="user-tags">
{% set actor_tags = actor.getSelfTags() %} {% if actor_tags %}
{% for tag in actor_tags %}
<div class="tags"> <a href='#'><i> #{{ tag }} </i></a>
{% if actor_tags %} {% endfor %}
{% for tag in actor_tags %} {% else %}
<a href='#'><i> #{{ tag }} </i></a> <i> {{ '(No tags)' | trans }} </i>
{% endfor %} {% endif %}
{% else %} </nav>
<i> {{ '(No tags)' | trans }} </i>
{% endif %}
</div>
</div>
{% set actor_bio = actor.getBio() %}
<div class="actor-bio">
{% if actor_bio %}
<p>{{ actor_bio }}</p>
{% else %}
<p>{{ '(No bio)' | trans }}</p>
{% endif %}
</div>
<section class="user-bio">
{% if actor_bio %}
<p>{{ actor_bio }}</p>
{% else %}
<p>{{ '(No bio)' | trans }}</p>
{% endif %}
</section>
</div>
</a>
</section> </section>
{% endblock body %} {% endblock body %}

View File

@ -4,10 +4,12 @@
{% block body %} {% block body %}
<section class="section-widget section-widget-padded"> <section class="section-widget section-widget-padded">
<div class="actors"> <h2 class="section-title">{{ "Actors" | trans }}</h2>
<div class="section-widget-padded">
{% if actors is defined and actors is not empty %} {% if actors is defined and actors is not empty %}
{% for actor in actors %} {% for actor in actors %}
{% include 'directory/actor.html.twig' with {'actor': actor, 'have_user': have_user} only %} {% include 'directory/actor.html.twig' %}
{% endfor %} {% endfor %}
{% else %} {% else %}
<h1>{% trans %}No actors here.{% endtrans %}</h1> <h1>{% trans %}No actors here.{% endtrans %}</h1>

View File

@ -5,7 +5,7 @@
<a id="anchor-right-panel" class="anchor-hidden" title="{{ 'Press tab to access selected region!' | trans }}"></a> <a id="anchor-right-panel" class="anchor-hidden" title="{{ 'Press tab to access selected region!' | trans }}"></a>
<aside class="panel-content accessibility-target"> <aside class="panel-content accessibility-target">
{% if post_form is defined %} {% if post_form is defined and not post_form.isRendered() %}
<section class="section-widget" title={{ 'Create a new note.' | trans }}> <section class="section-widget" title={{ 'Create a new note.' | trans }}>
<details class="section-title-details" title={{ 'Expand if you want to access more options.' | trans }}> <details class="section-title-details" title={{ 'Expand if you want to access more options.' | trans }}>
<summary class="section-title-summary"> <summary class="section-title-summary">