From 3f618c26741334c97af3a75fd9e03391da0607e5 Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Wed, 22 Sep 2021 14:10:36 +0100 Subject: [PATCH] [TWIG][Cards][Profile] Card templates! Profile now has a card template to be used everywhere you need to show quick actor information. --- .../templates/directory/actors.html.twig | 2 +- templates/actor/view.html.twig | 38 +------------------ .../cards/profile/view.html.twig | 17 +++++---- templates/{Poll => poll}/newpoll.html.twig | 0 .../{Poll => poll}/respondpoll.html.twig | 0 templates/{Poll => poll}/showpoll.html.twig | 0 templates/{Poll => poll}/view.html.twig | 0 templates/sidepanel/left/left.html.twig | 30 +-------------- 8 files changed, 14 insertions(+), 73 deletions(-) rename plugins/Directory/templates/directory/actor.html.twig => templates/cards/profile/view.html.twig (65%) rename templates/{Poll => poll}/newpoll.html.twig (100%) rename templates/{Poll => poll}/respondpoll.html.twig (100%) rename templates/{Poll => poll}/showpoll.html.twig (100%) rename templates/{Poll => poll}/view.html.twig (100%) diff --git a/plugins/Directory/templates/directory/actors.html.twig b/plugins/Directory/templates/directory/actors.html.twig index bd06ebbd41..1d5eb10774 100644 --- a/plugins/Directory/templates/directory/actors.html.twig +++ b/plugins/Directory/templates/directory/actors.html.twig @@ -9,7 +9,7 @@
{% if actors is defined and actors is not empty %} {% for actor in actors %} - {% include 'directory/actor.html.twig' %} + {% block profile_view %}{% include 'cards/profile/view.html.twig' %}{% endblock profile_view %} {% endfor %} {% else %}

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

diff --git a/templates/actor/view.html.twig b/templates/actor/view.html.twig index e97cc2a25c..31d5e472ba 100644 --- a/templates/actor/view.html.twig +++ b/templates/actor/view.html.twig @@ -1,43 +1,9 @@ {% extends 'stdgrid.html.twig' %} -{% set id = actor.getId() %} -{% set nickname = actor.getNickname() %} -{% set actor_bio = actor.getBio() %} -{% set actor_tags = actor.getSelfTags() %} -{% set avatar = actor.getAvatarUrl() %} - -{% block title %}{{ nickname }}'s profile{% endblock %} +{% block title %}{{ actor.getNickname() }}'s profile{% endblock %} {% block body %} -
- - {{ nickname }}{{ '\'s avatar.' | trans }} -
- {{ nickname }} - - - - -
- {% if actor_bio %} -

{{ actor_bio }}

- {% else %} -

{{ '(no bio)' | trans }}

- {% endif %} -
-
- -
- -
+{% block profile_view %}{% include 'cards/profile/view.html.twig' %}{% endblock profile_view %}
diff --git a/plugins/Directory/templates/directory/actor.html.twig b/templates/cards/profile/view.html.twig similarity index 65% rename from plugins/Directory/templates/directory/actor.html.twig rename to templates/cards/profile/view.html.twig index 733a01527d..6eae292f55 100644 --- a/plugins/Directory/templates/directory/actor.html.twig +++ b/templates/cards/profile/view.html.twig @@ -3,12 +3,12 @@ {% set actor_tags = actor.getSelfTags() %} {% set actor_bio = actor.getBio() %} -{% block body %} -
+{% block profile_view %} +
- {{ 'Your account\'s avatar.' | trans }} + {{ actor_nickname }}{{ '\'s avatar.' | trans }}
- {{ actor_nickname }} + {{ actor_nickname }}
+
{{ 'Subscriptions' | trans }}{{ actor.getSubscriptionsCount() }}
+
{{ 'Subscribers' | trans }}{{ actor.getSubscribersCount() }}
+ {% if actor_bio %}

{{ actor_bio }}

{% else %} @@ -29,7 +32,7 @@
-
+
-
-{% endblock body %} \ No newline at end of file +
+{% endblock profile_view %} diff --git a/templates/Poll/newpoll.html.twig b/templates/poll/newpoll.html.twig similarity index 100% rename from templates/Poll/newpoll.html.twig rename to templates/poll/newpoll.html.twig diff --git a/templates/Poll/respondpoll.html.twig b/templates/poll/respondpoll.html.twig similarity index 100% rename from templates/Poll/respondpoll.html.twig rename to templates/poll/respondpoll.html.twig diff --git a/templates/Poll/showpoll.html.twig b/templates/poll/showpoll.html.twig similarity index 100% rename from templates/Poll/showpoll.html.twig rename to templates/poll/showpoll.html.twig diff --git a/templates/Poll/view.html.twig b/templates/poll/view.html.twig similarity index 100% rename from templates/Poll/view.html.twig rename to templates/poll/view.html.twig diff --git a/templates/sidepanel/left/left.html.twig b/templates/sidepanel/left/left.html.twig index 2b1f35eb77..a8ee4575a9 100644 --- a/templates/sidepanel/left/left.html.twig +++ b/templates/sidepanel/left/left.html.twig @@ -6,36 +6,8 @@