From 077975136eb8276aea594f64bad425b3217c91db Mon Sep 17 00:00:00 2001 From: Eliseu Amaro Date: Mon, 28 Feb 2022 12:43:40 +0000 Subject: [PATCH] [CARDS][Note] Both 'in conversation' and 'in reply to' link to note's conversation. The former anchors it's id, while the latter it's parent id --- templates/cards/blocks/note.html.twig | 26 ++++- templates/cards/macros/note/types.html.twig | 105 +------------------- 2 files changed, 30 insertions(+), 101 deletions(-) diff --git a/templates/cards/blocks/note.html.twig b/templates/cards/blocks/note.html.twig index b003866fcf..4c02b4d811 100644 --- a/templates/cards/blocks/note.html.twig +++ b/templates/cards/blocks/note.html.twig @@ -83,7 +83,7 @@
{{ block('note_author') }} - {{ 'in conversation' | trans }} {% endblock note_info %} +{% block note_context %} + {% set notification_targets = note.getNotificationTargets() %} + {% if notification_targets is not empty %} + {% for target in notification_targets %} + {% if target.isGroup() %} + + {{'in ' | trans}} + {{ mention(target) | raw }} + + {% else %} + + {{'in reply to' | trans}} + {{ mention(target) | raw }} + + {% endif %} + {% endfor %} + {% endif %} +{% endblock note_context %} + {% block note_complementary %} {% set complementary_info_array = handle_event('AppendCardNote', { 'note': note, 'request': app.request }) %} diff --git a/templates/cards/macros/note/types.html.twig b/templates/cards/macros/note/types.html.twig index 918518f974..6911d18625 100644 --- a/templates/cards/macros/note/types.html.twig +++ b/templates/cards/macros/note/types.html.twig @@ -9,11 +9,12 @@ {% set actor_url = actor.getUrl() %} {% set mention = mention(actor) %} {% set note_language = note.getNoteLanguageShortDisplay() %} + {% set note_anchor = 'note-anchor-' ~ note.getId() %}
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }} @@ -22,27 +23,7 @@ {{ block('note_info', 'cards/blocks/note.html.twig') }}
- {% set notification_targets = note.getNotificationTargets() %} - {% if notification_targets is not empty %} - {% for target in notification_targets %} - {% if target.isGroup() %} - - {{'in ' | trans}} - {{ mention(target) | raw }} - - {% else %} - - {{'in reply to' | trans}} - {{ mention(target) | raw }} - - {% endif %} - {% endfor %} - {% endif %} + {{ block('note_context', 'cards/blocks/note.html.twig') }} {{ block('note_text', 'cards/blocks/note.html.twig') }} {{ block('note_attachments', 'cards/blocks/note.html.twig') }} {{ block('note_links', 'cards/blocks/note.html.twig') }} @@ -99,87 +80,11 @@ {# args: { 'type': { 'page_full' }, 'note': note, ?'replies': { note, ?replies }, ?'extra': { 'foo': bar } #} {% macro page_full(args) %} - {% set note = args.note %} - {% if args.replies is defined %}{% set replies = args.replies %}{% else %}{% set replies = null %}{% endif %} - {% if args.extra is defined %}{% set extra = args.extra %}{% else %}{% set extra = null %}{% endif %} - - {% set actor = note.getActor() %} - {% set nickname = actor.getNickname() %} - {% set fullname = actor.getFullname() %} - {% set actor_uri = actor.getUri() %} - {% set actor_url = actor.getUrl() %} - {% set mention = mention(actor) %} - {% set note_language = note.getNoteLanguageShortDisplay() %} - -
- {{ block('note_sidebar', 'cards/blocks/note.html.twig') }} - -
- {{ block('note_info', 'cards/blocks/note.html.twig') }} - -
- {% if extra.parent is defined %} - - {{'in reply to' | trans}} {{ extra.parent | raw }} - - {% endif %} - {{ block('note_text', 'cards/blocks/note.html.twig') }} - {{ block('note_attachments', 'cards/blocks/note.html.twig') }} - {{ block('note_links', 'cards/blocks/note.html.twig') }} -
-
- {{ block('note_complementary', 'cards/blocks/note.html.twig') }} -
- - {% if replies is defined %} - {{ block('note_replies', 'cards/blocks/note.html.twig') }} - {% endif %} + {# TODO #} {% endmacro page_full %} {# args: { 'type': { 'page_compact' }, 'note': note, ?'extra': { 'foo': bar } } #} {% macro page_compact(args) %} - {% set note = args.note %} - {% if args.extra is defined %}{% set extra = args.extra %}{% else %}{% set extra = null %}{% endif %} - - {% set actor = note.getActor() %} - {% set nickname = actor.getNickname() %} - {% set fullname = actor.getFullname() %} - {% set actor_uri = actor.getUri() %} - {% set actor_url = actor.getUrl() %} - {% set mention = mention(actor) %} - - + {# TODO #} {% endmacro page_compact %} \ No newline at end of file