forked from GNUsocial/gnu-social
Eliseu Amaro
e70acd5c3b
This little abstraction layer made it a bit easier to add a different title to a Note or Actor Feed Collection template, from whichever controller that uses it. Please, bear in mind, that abstract templates such as those found in Components\Collection, may act in a very 'declarative' way upon using them. This makes it difficult to dynamically choose what type of header is used without undergoing a mining operation in the likes of a pyramid of doom. Hence, this _little_ change.
162 lines
7.6 KiB
Twig
162 lines
7.6 KiB
Twig
{% block note_actions %}
|
|
{% if app.user or note_actions_hide is defined %}
|
|
<menu class="note-actions">
|
|
<li class="note-actions-extra">
|
|
<details class="note-actions-extra-details">
|
|
<summary>
|
|
{{ icon('kebab', 'icon icon-note-actions-extra') | raw }}
|
|
</summary>
|
|
<menu>
|
|
<a href="{{ note.getUrl() }}">{{ 'Permalink' | trans }}</a>
|
|
<hr>
|
|
{% for current_action in get_extra_note_actions(note) %}
|
|
<a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
|
|
{% endfor %}
|
|
</menu>
|
|
</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 %}
|
|
</menu>
|
|
{% endif %}
|
|
{% endblock note_actions %}
|
|
|
|
{% block note_replies %}
|
|
{% import '/cards/macros/note.html.twig' as noteView %}
|
|
|
|
{% if replies is defined and replies is not empty %}
|
|
<section class="note-replies" title="{{ 'Replies to ' | trans }}{{ nickname }}{{ '\'s note' | trans }}">
|
|
<div class="note-replies-start"></div>
|
|
<div class="u-in-reply-to replies">
|
|
{% for conversation in replies %}
|
|
{% if extra.depth is defined %}
|
|
{% set depth_increment = {'depth': extra.depth + 1} %}
|
|
{% set parent = {'parent': block('note_author')} %}
|
|
{% set extra = extra|merge(depth_increment) %}
|
|
{% set extra = extra|merge(parent) %}
|
|
{% endif %}
|
|
<span class="note-replies-indicator" role="presentation"></span>
|
|
{{ noteView.note_vanilla(conversation['note'], conversation['replies'], extra) }}
|
|
{% endfor %}
|
|
</div>
|
|
</section>
|
|
{% 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="{{ 'Attachments for this note' | trans }}">
|
|
{% for attachment in note.getAttachments() %}
|
|
{% include 'cards/blocks/attachment.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="{{ 'Main note content' | trans }}">
|
|
{% set paragraph_array = note.getRenderedSplit() %}
|
|
{% for paragraph in paragraph_array %}
|
|
<p>{{ paragraph | raw }}</p>
|
|
{% endfor %}
|
|
</div>
|
|
{% endblock note_text %}
|
|
|
|
{% block note_author %}
|
|
{# Microformat's h-card properties indicates a face icon is a "u-logo" #}
|
|
<a href="{{ actor_url }}" class="note-author-url u-url"
|
|
title="{{ nickname }}{{ '\'s profile' | trans }}">
|
|
{% if fullname is not null %}{{ fullname }}{% else %}{{ nickname }}{% endif %}
|
|
</a>
|
|
|
|
<small class="note-author-uri" title="{{ 'Author related permalinks' | trans }}">
|
|
<a href="{{ actor_uri }}" class="u-url" title="{% trans %} %nickname%'s permalink {% endtrans %}">{{ mention }}</a>
|
|
</small>
|
|
{% endblock note_author %}
|
|
|
|
{% block note_sidebar %}
|
|
<aside class="note-sidebar" title="{{ nickname }} {{ 'avatar' | trans }}">
|
|
{% 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 %}
|
|
<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() }}"
|
|
title="{{ 'Conversation\'s permalink' | trans }}"
|
|
class="note-conversation-url">{{ 'in conversation' | trans }}</a>
|
|
<a href="{{ note.getUrl() }}"
|
|
title="{{ 'Note\'s permalink' | trans }}"
|
|
class="note-url">{{ note.getModified() | ago }}</a>
|
|
</small>
|
|
</header>
|
|
{% endblock note_info %}
|
|
|
|
{% block note_complementary %}
|
|
{% set complementary_info_array = handle_event('AppendCardNote', { 'note': note, 'request': app.request }) %}
|
|
<aside
|
|
title="{{ 'Additional note context information and actions' | trans }}"
|
|
class="note-complementary">
|
|
{% if complementary_info_array is not empty %}
|
|
<div class="note-complementary-info">
|
|
{% for complementary_info in complementary_info_array %}
|
|
{% set actor_count = complementary_info['actors'] | length %}
|
|
{% set counter = 0 %}
|
|
{% for complementary_info_actor in complementary_info['actors'] %}
|
|
<span>
|
|
{% if app.user is not null %}
|
|
{% if complementary_info_actor is defined and complementary_info_actor.getNickname() != app.user.nickname %}
|
|
<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 %}
|
|
{% set counter = counter + 1 %}
|
|
{% endif %}
|
|
{% else %}
|
|
{% 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 %}
|
|
{% set counter = counter + 1 %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% if complementary_info['action'] is defined and not null and counter > 0 %}
|
|
{% if counter > 1 %}
|
|
{{ ' have ' | trans }}
|
|
{% else %}
|
|
{{ ' has ' | trans }}
|
|
{% endif %}
|
|
{{ complementary_info['action'] ~ ' this note' | trans }}
|
|
{% endif %}
|
|
</span>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
{{ block('note_actions', 'cards/blocks/note.html.twig') }}
|
|
</aside>
|
|
{% endblock note_complementary %} |