From 546c5c84fd78b41151975b4d50e9cfd6ea86e8cc Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Mon, 6 Dec 2021 22:22:23 +0000 Subject: [PATCH] [COMPONENTS][Tag] Actor/Note tag template polished [PLUGINS][RelatedTags] Disable rendering of template when no results are found --- components/Tag/Controller/Tag.php | 1 + components/Tag/templates/actor_tag_feed.html.twig | 11 ++++++++++- components/Tag/templates/note_tag_feed.html.twig | 13 ++++++++++--- .../templates/related_tags/actor_tags.html.twig | 6 ++++-- .../templates/related_tags/note_tags.html.twig | 15 +++++++++------ .../assets/default_theme/css/widgets/sections.css | 10 ++++++++++ 6 files changed, 44 insertions(+), 12 deletions(-) diff --git a/components/Tag/Controller/Tag.php b/components/Tag/Controller/Tag.php index b79ab69b4a..172a91f83e 100644 --- a/components/Tag/Controller/Tag.php +++ b/components/Tag/Controller/Tag.php @@ -36,6 +36,7 @@ class Tag extends Controller return [ '_template' => $template, + 'tag_name' => $canonical, 'results' => $results, 'page' => $page, ]; diff --git a/components/Tag/templates/actor_tag_feed.html.twig b/components/Tag/templates/actor_tag_feed.html.twig index 8aa818f48e..0b888ce821 100644 --- a/components/Tag/templates/actor_tag_feed.html.twig +++ b/components/Tag/templates/actor_tag_feed.html.twig @@ -1,6 +1,13 @@ {% extends 'base.html.twig' %} +{% block stylesheets %} + {{ parent() }} + +{% endblock stylesheets %} + {% block body %} +

{{ 'Notes containing tag:' | trans }} {{ tag_name }}

+ {% for pinned in handle_event('AddPinnedFeedContent', app.request) %} {% include pinned['template'] with { 'actor_tags': pinned['vars']} only %} {% endfor %} @@ -9,5 +16,7 @@ {% block profile_view %}{% include 'cards/profile/view.html.twig' %}{% endblock profile_view %} {% endfor %} - {{ "Page: " ~ page }} +
+ {{ "Page: " ~ page }} +
{% endblock %} diff --git a/components/Tag/templates/note_tag_feed.html.twig b/components/Tag/templates/note_tag_feed.html.twig index 9bf82e7955..61644da68c 100644 --- a/components/Tag/templates/note_tag_feed.html.twig +++ b/components/Tag/templates/note_tag_feed.html.twig @@ -1,18 +1,25 @@ {% extends 'base.html.twig' %} {% import '/cards/note/view.html.twig' as noteView %} +{% block stylesheets %} + {{ parent() }} + +{% endblock stylesheets %} + {% block body %} +

{{ 'Notes containing tag:' | trans }} {{ tag_name }}

+ {% for pinned in handle_event('AddPinnedFeedContent', app.request) %} {% include pinned['template'] with { 'note_tags': pinned['vars']} only %} {% endfor %} {% for note in results %} {% block current_note %} -
{{ noteView.macro_note(note) }} -
{% endblock current_note %} {% endfor %} - {{ "Page: " ~ page }} +
+ {{ "Page " ~ page }} +
{% endblock %} diff --git a/plugins/RelatedTags/templates/related_tags/actor_tags.html.twig b/plugins/RelatedTags/templates/related_tags/actor_tags.html.twig index 069a966d54..a04b6482db 100644 --- a/plugins/RelatedTags/templates/related_tags/actor_tags.html.twig +++ b/plugins/RelatedTags/templates/related_tags/actor_tags.html.twig @@ -1,7 +1,9 @@ -
-

Related tags:

+{% if note_tags is not empty %} +
+

Related tags:

{% for at in actor_tags %} {% include 'cards/tag/actor_tag.html.twig' with { 'tag': at, 'actor': null } %} {% endfor %}
+{% endif %} diff --git a/plugins/RelatedTags/templates/related_tags/note_tags.html.twig b/plugins/RelatedTags/templates/related_tags/note_tags.html.twig index afa2a6e6c7..dcec83f917 100644 --- a/plugins/RelatedTags/templates/related_tags/note_tags.html.twig +++ b/plugins/RelatedTags/templates/related_tags/note_tags.html.twig @@ -1,6 +1,9 @@ -
-

Related tags:

- {% for nt in note_tags %} - {% include 'cards/tag/note_tag.html.twig' with { 'tag': nt } %} - {% endfor %} -
+{% if note_tags is not empty %} +
+

Related tags:

+ + {% for nt in note_tags %} + {% include 'cards/tag/note_tag.html.twig' with { 'tag': nt } %} + {% endfor %} +
+{% endif %} diff --git a/public/assets/default_theme/css/widgets/sections.css b/public/assets/default_theme/css/widgets/sections.css index 7021bd16a7..6d1e705cc3 100644 --- a/public/assets/default_theme/css/widgets/sections.css +++ b/public/assets/default_theme/css/widgets/sections.css @@ -38,6 +38,10 @@ margin-top: var(--smaller); } +.profile-info-bio { + word-break: break-all; +} + .profile-avatar { max-width: 4rem; max-height: 4rem; @@ -66,6 +70,12 @@ padding: var(--smaller); } +.section-widget-paging { + display: block; + margin-top: var(--smaller); + margin-left: auto; +} + .section-title { font-size: var(--small); font-weight: 700;