[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

This commit is contained in:
Eliseu Amaro 2022-02-28 12:43:40 +00:00
parent 5495a3c5ec
commit 077975136e
Signed by: eliseuamaro
GPG Key ID: 96DA09D4B97BC2D5
2 changed files with 30 additions and 101 deletions

View File

@ -83,7 +83,7 @@
<header class="note-info" title="{{ 'Information about note\'s author' | trans }}">
{{ block('note_author') }}
<small class="note-conversation-info" title="{{ 'Conversation related permalinks' | trans }}">
<a href="{{ note.getConversationUrl() }}"
<a href="{{ note.getConversationUrl() ~ '#' ~ note_anchor }}"
title="{{ 'Conversation\'s permalink' | trans }}"
class="note-conversation-url">{{ 'in conversation' | trans }}</a>
<a href="{{ note.getUrl() }}"
@ -93,6 +93,30 @@
</header>
{% 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() %}
<em tabindex="0"
class="note-replies-parent"
title="{{'The group in which this note was addressed to' | trans}}">
{{'in ' | trans}}
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>
</em>
{% else %}
<em tabindex="0"
class="note-replies-parent"
title="{{'Whom this is a reply to' | trans}}"
aria-flowto="note-anchor-{{ note.getReplyTo() }}">
<a href="{{ note.getConversationUrl() ~ '#note-anchor-' ~ note.getReplyTo() }}">{{'in reply to' | trans}}</a>
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>
</em>
{% endif %}
{% endfor %}
{% endif %}
{% endblock note_context %}
{% block note_complementary %}
{% set complementary_info_array = handle_event('AppendCardNote', { 'note': note, 'request': app.request }) %}

View File

@ -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() %}
<article
tabindex="0"
title="{{'A note by actor' | trans}} {{ nickname }}"
id="{{ 'note-anchor-' ~ note.getId() }}"
id="{{ note_anchor }}"
class="h-entry hentry note"
lang="{{ note.getLanguageLocale() }}">
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
@ -22,27 +23,7 @@
{{ block('note_info', 'cards/blocks/note.html.twig') }}
<section class="e-content entry-content note-content" title="{{ 'Note\'s main content' | trans }}">
{% set notification_targets = note.getNotificationTargets() %}
{% if notification_targets is not empty %}
{% for target in notification_targets %}
{% if target.isGroup() %}
<em tabindex="0"
class="note-replies-parent"
title="{{'The group in which this note was addressed to' | trans}}">
{{'in ' | trans}}
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>
</em>
{% else %}
<em tabindex="0"
class="note-replies-parent"
title="{{'Whom this is a reply to' | trans}}"
aria-flowto="note-anchor-{{ note.getReplyTo() }}">
{{'in reply to' | trans}}
<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>
</em>
{% 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() %}
<article
tabindex="0"
title="{{'A note by actor' | trans}} {{ nickname }}"
id="{{ 'note-anchor-' ~ note.getId() }}"
class="h-entry hentry note"
lang="{{ note.getLanguageLocale() }}">
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
<div class="note-wrapper">
{{ block('note_info', 'cards/blocks/note.html.twig') }}
<section class="e-content entry-content note-content" title="{{ 'Note\'s main content' | trans }}">
{% if extra.parent is defined %}
<em
tabindex="0"
class="note-replies-parent"
title="{{'This is a reply with depth: ' | trans}} {{ extra.depth }}"
aria-flowto="note-anchor-">
{{'in reply to' | trans}} {{ extra.parent | raw }}
</em>
{% 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') }}
</section>
</div>
{{ block('note_complementary', 'cards/blocks/note.html.twig') }}
</article>
{% 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) %}
<article
tabindex="0"
title="{{'A note by actor' | trans}} {{ nickname }}"
id="{{ 'note-compact-anchor-' ~ note.getId() }}"
class="h-entry hentry note"
lang="{{ note.getLanguageLocale() }}">
<div class="note-wrapper">
<header class="note-info">
{{ block('note_sidebar', 'cards/blocks/note.html.twig') }}
{{ block('note_author', 'cards/blocks/note.html.twig') }}
</header>
<section class="e-content entry-content note-content" title="{{ 'Note\'s main content' | trans }}">
<small class="note-conversation-info">
<a href="{{ note.getConversationUrl() }}"
class="note-conversation-url">{{ 'in conversation' | trans }}</a>
<a href="{{ note.getUrl() }}"
class="note-url">{{ note.getModified() | ago }}</a>
</small>
<hr>
{{ block('note_text', 'cards/blocks/note.html.twig') }}
</section>
</div>
</article>
{# TODO #}
{% endmacro page_compact %}