gnu-social/templates/cards/note/view.html.twig

199 lines
7.7 KiB
Twig
Raw Normal View History

{% block note_actions %}
{% if app.user or note_actions_hide is defined %}
<div class="note-actions note-info-end">
<ul>
<li class="note-actions-extra">
<details class="note-actions-extra-details">
<summary>
{{ icon('kebab', 'icon icon-note-actions-extra') | raw }} {# button-container #}
</summary>
<ul>
<li>
<a href="{{ note.getUrl() }}">{{ 'Permalink' | trans }}</a>
</li>
<hr>
{% for current_action in get_extra_note_actions(note) %}
<li>
<a class="{{ current_action["classes"] }}"
href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
</li>
{% endfor %}
</ul>
</details>
</li>
{% for current_action in get_note_actions(note) %}
<li>
<a title="{{ current_action["title"] | trans }}"
class="{{ current_action["classes"] }}"
href="{{ current_action["url"] }}"></a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endblock note_actions %}
{% block note_replies %}
{% if replies is defined and replies is not empty %}
<div class="u-in-reply-to replies">
<span class="note-replies-start" tabindex="0">{{ 'Replies to ' | trans }}{{ nickname }}{{ '\'s note' | trans }}</span>
{% for conversation in replies %}
{{ _self.macro_note(conversation['note'], conversation['replies']) }}
<hr tabindex="0" title="{{ 'End of reply' | trans }}">
{% endfor %}
</div>
{% endif %}
{% endblock note_replies %}
{% block note_attachments %}
{% if hide_attachments is not defined %}
{% if note.getAttachments() is not empty %}
<section class="note-attachments" tabindex="0"
title="{{ 'Note attachments.' | trans }}">
{% for attachment in note.getAttachments() %}
{% include '/cards/attachments/view.html.twig' with {'attachment': attachment, 'note': note, 'title': attachment.getBestTitle(note)} only %}
{% endfor %}
</section>
{% endif %}
{% endif %}
{% endblock note_attachments %}
{% block note_links %}
{% if note.getLinks() is not empty %}
<div class="note-links" title="{{ 'Shared links.' | trans }}">
{% for link in note.getLinks() %}
{% for block in handle_event('ViewLink', {'link': link, 'note': note}) %}
{{ block | raw }}
{% endfor %}
{% endfor %}
</div>
{% endif %}
{% endblock note_links %}
{% block note_text %}
<div class="note-text" tabindex="0"
title="{{ 'Note text content.' | trans }}">
{{ note.getRendered() | raw }}
</div>
{% endblock note_text %}
{% block note_author %}
{# Microformat's h-card properties indicates a face icon is a "u-logo" #}
<a href="{{ actor_url }}">
<header class="note-author-fullname" tabindex="0"
title="{{ 'Begin a note by the user: ' | trans }} {{ nickname }}">
{% if fullname is not null %}
{{ fullname }}
{% else %}
{{ nickname }}
{% endif %}
</header>
</a>
<small class="note-author-nickname">
<a href="{{ actor_uri }}"
class="note-author-url u-url">{{ mention }}</a>
</small>
{% endblock note_author %}
{% block note_sidebar %}
<aside class="note-sidebar">
{% set actor_avatar_dimensions = actor.getAvatarDimensions() %}
<img class="u-logo avatar" src="{{ note.getActorAvatarUrl() }}"
alt="{{ nickname }}'s avatar"
width="{{ actor_avatar_dimensions['width'] }}"
height="{{ actor_avatar_dimensions['height'] }}">
</aside>
{% endblock note_sidebar %}
{% block note_info %}
<div class="note-info">
<div class="note-info-start">
{{ block('note_author') }}
<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>
</div>
{{ block('note_actions') }}
</div>
{% endblock note_info %}
{% block note_complementary_info %}
{% for complementary_info in handle_event('AppendCardNote', {'note': note }) %}
<aside title="{{ 'Note\'s complementary information' | trans }}"
class="note-complementary">
{% set actor_count = complementary_info['actors'] | length %}
{% set counter = 0 %}
{% for complementary_info_actor in complementary_info['actors'] %}
{% if complementary_info_actor is defined %}
<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}{% if actor_count > 1 and counter < actor_count - 2 %}{{ ', ' | trans }}{% endif %}</a>
{% if counter == actor_count - 2 %}
{{ ' and ' | trans }}
{% endif %}
{% endif %}
{% set counter = counter + 1 %}
{% endfor %}
{% if complementary_info['action'] is defined and not null %}
{% if counter > 1 %}
{{ ' have ' | trans }}
{% else %}
{{ ' has ' | trans }}
{% endif %}
{{ complementary_info['action'] ~ ' this note' | trans }}
{% endif %}
</aside>
{% endfor %}
{% endblock note_complementary_info %}
{% macro macro_note(note, replies) %}
{% 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 id="{{ 'note-anchor-' ~ note.getId() }}"
class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar') }}
<div class="note-wrapper">
{{ block('note_info') }}
<section role="dialog" class="e-content entry-content note-content">
{{ block('note_text') }}
{{ block('note_attachments') }}
{{ block('note_links') }}
</section>
{{ block('note_replies') }}
{{ block('note_complementary_info') }}
</div>
</article>
{% endmacro macro_note %}
{% macro macro_note_minimal(note) %}
{% 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 class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
{{ block('note_sidebar') }}
<div class="note-wrapper">
{{ block('note_info') }}
<section role="dialog" class="e-content entry-content note-content">
{{ block('note_text') }}
</section>
</div>
</article>
{% endmacro macro_note_minimal %}