note.html.twig 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. {% block note_actions %}
  2. {% if app.user or note_actions_hide is defined %}
  3. <menu class="note-actions">
  4. <li class="note-actions-extra">
  5. <details class="note-actions-extra-details">
  6. <summary>
  7. {{ icon('kebab', 'icon icon-note-actions-extra') | raw }}
  8. </summary>
  9. <menu>
  10. <a href="{{ note.getUrl() }}">{% trans %}Permalink{% endtrans %}</a>
  11. <hr>
  12. {% for current_action in get_extra_note_actions(note) %}
  13. <a class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
  14. {% endfor %}
  15. </menu>
  16. </details>
  17. </li>
  18. {% for current_action in get_note_actions(note) %}
  19. <li><a title="{{ current_action["title"] | trans }}" class="{{ current_action["classes"] }}" href="{{ current_action["url"] }}"></a></li>
  20. {% endfor %}
  21. </menu>
  22. {% endif %}
  23. {% endblock note_actions %}
  24. {% block note_attachments %}
  25. {% if hide_attachments is not defined %}
  26. {% if note.getAttachments() is not empty %}
  27. <section class="note-attachments" tabindex="0"
  28. title="{% trans %}Attachments for this note{% endtrans %}">
  29. {% for attachment in note.getAttachments() %}
  30. {% include 'cards/blocks/attachment.html.twig' with {'attachment': attachment, 'note': note, 'title': attachment.getBestTitle(note)} only %}
  31. {% endfor %}
  32. </section>
  33. {% endif %}
  34. {% endif %}
  35. {% endblock note_attachments %}
  36. {% block note_links %}
  37. {% if note.getLinks() is not empty %}
  38. <div class="note-links" title="{% trans %}Shared links{% endtrans %}">
  39. {% for link in note.getLinks() %}
  40. {% for block in handle_event('ViewLink', {'link': link, 'note': note}) %}
  41. {{ block | raw }}
  42. {% endfor %}
  43. {% endfor %}
  44. </div>
  45. {% endif %}
  46. {% endblock note_links %}
  47. {% block note_text %}
  48. <div class="note-text" tabindex="0"
  49. title="{% trans %}Main note content{% endtrans %}">
  50. {% set paragraph_array = note.getRenderedSplit() %}
  51. {% for paragraph in paragraph_array %}
  52. <p>{{ paragraph | raw }}</p>
  53. {% endfor %}
  54. </div>
  55. {% endblock note_text %}
  56. {% block note_author %}
  57. {# Microformat's h-card properties indicates a face icon is a "u-logo" #}
  58. <a href="{{ actor_url }}" class="note-author-url u-url"
  59. title="{% trans %}%nickname's profile{% endtrans %}">
  60. {% if fullname is not null %}{{ fullname }}{% else %}{{ nickname }}{% endif %}
  61. </a>
  62. <small class="note-author-uri" title="{% trans %}Author related permalinks{% endtrans %}">
  63. <a href="{{ actor_uri }}" class="u-url" title="{% trans %}%nickname%'s permalink {% endtrans %}">{{ mention }}</a>
  64. </small>
  65. {% endblock note_author %}
  66. {% block note_sidebar %}
  67. <aside class="note-sidebar" title="{% trans %}%nickname%'s avatar{% endtrans %}">
  68. {% set actor_avatar_dimensions = actor.getAvatarDimensions() %}
  69. <img class="u-logo avatar" src="{{ note.getActorAvatarUrl() }}"
  70. alt="{% trans %}%nickname%'s avatar{% endtrans %}"
  71. width="{{ actor_avatar_dimensions['width'] }}"
  72. height="{{ actor_avatar_dimensions['height'] }}">
  73. </aside>
  74. {% endblock note_sidebar %}
  75. {% block note_info %}
  76. <header class="note-info" title="{% trans %}Information about note's author{% endtrans %}">
  77. {{ block('note_author') }}
  78. <small class="note-conversation-info" title="{% trans %}Conversation related permalinks{% endtrans %}">
  79. <a href="{{ note.getConversationUrl() ~ '#' ~ note_anchor }}"
  80. title="{% trans %}Conversation's permalink{% endtrans %}"
  81. class="note-conversation-url">{% trans %}in conversation{% endtrans %}</a>
  82. <a href="{{ note.getUrl() }}"
  83. title="{% trans %}Note's permalink{% endtrans %}"
  84. class="note-url">{{ note.getModified() | ago }}</a>
  85. </small>
  86. </header>
  87. {% endblock note_info %}
  88. {% block note_context %}
  89. {% set attentions = note.getAttentionTargets() %}
  90. {% if attentions is not empty %}
  91. {% for target in attentions %}
  92. {% if target.isGroup() %}
  93. <em tabindex="0"
  94. class="note-replies-parent"
  95. title="{% trans %}The group in which this note was addressed to{% endtrans %}">
  96. {% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
  97. {% trans %}in %mentionAnchor%{% endtrans %}
  98. </em>
  99. {% else %}
  100. <em tabindex="0"
  101. class="note-replies-parent"
  102. title="{% trans %}Whom this is a reply to{% endtrans %}"
  103. aria-flowto="note-anchor-{{ note.getReplyTo() }}">
  104. {% set replyAnchor %}<a href="{{ note.getConversationUrl() ~ "#note-anchor-" ~ note.getReplyTo() }}">{% endset %}
  105. {% set mentionAnchor %}<a href="{{ target.getUrl() }}">{{ mention(target) | raw }}</a>{% endset %}
  106. {% trans %}%replyAnchor% in reply to %mentionAnchor%{% endtrans %}
  107. </em>
  108. {% endif %}
  109. {% endfor %}
  110. {% endif %}
  111. {% endblock note_context %}
  112. {% block note_complementary %}
  113. {% set complementary_info_array = handle_event('AppendCardNote', { 'note': note, 'request': app.request }) %}
  114. {% if app.user is not null or complementary_info_array is not empty %}
  115. <aside
  116. title="{% trans %}Additional note context information and actions{% endtrans %}"
  117. class="note-complementary">
  118. {% if complementary_info_array is not empty %}
  119. <div class="note-complementary-info">
  120. {% for complementary_info in complementary_info_array %}
  121. {% set formatted = [] %}
  122. {% for complementary_info_actor in complementary_info['actors'] %}
  123. {% if complementary_info_actor is defined and (app.user is null or complementary_info_actor.getId() != app.user.getId()) %}
  124. {% set tmp %}<a href="{{ complementary_info_actor.getUrl() }}">{{ complementary_info_actor.getNickname() }}</a>{% endset %}
  125. {% set formatted = formatted|merge([tmp]) %}
  126. {% endif %}
  127. {% endfor %}
  128. {% if formatted is not empty %}
  129. <span>
  130. {{ trans(
  131. [
  132. "{formatted} has {action} this note",
  133. "{formatted} have {action} this note"
  134. ],
  135. {
  136. 'count': formatted|length,
  137. 'formatted': trans_list(formatted),
  138. 'action': complementary_info['action']
  139. }
  140. ) | raw }}
  141. </span>
  142. {% endif %}
  143. {% endfor %}
  144. </div>
  145. {% endif %}
  146. {{ block('note_actions', 'cards/blocks/note.html.twig') }}
  147. </aside>
  148. {% endif %}
  149. {% endblock note_complementary %}