[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
No known key found for this signature in database
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
{
if (Common::user() != null) {
if (Common::user() !== null) {
$vars['user_avatar'] = self::getAvatarUrl();
}
return Event::next;

View File

@ -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;
}

View File

@ -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;
}

View File

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

View File

@ -4,10 +4,12 @@
{% block body %}
<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 %}
{% for actor in actors %}
{% include 'directory/actor.html.twig' with {'actor': actor, 'have_user': have_user} only %}
{% include 'directory/actor.html.twig' %}
{% endfor %}
{% else %}
<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>
<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 }}>
<details class="section-title-details" title={{ 'Expand if you want to access more options.' | trans }}>
<summary class="section-title-summary">