view.html.twig 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. {% block note_actions %}
  2. {% if app.user or note_actions_hide is defined %}
  3. <div class="note-actions">
  4. <ul>
  5. <li class="note-actions-extra">
  6. <details class="note-actions-extra-details">
  7. <summary>
  8. {{ icon('kebab', 'icon icon-note-actions-extra') | raw }} {# button-container #}
  9. </summary>
  10. <ul>
  11. {% for current_action in get_extra_note_actions(note) %}
  12. <li>
  13. <a class="{{ current_action["classes"] }}"
  14. href="{{ current_action["url"] }}">{{ current_action['title'] }}</a>
  15. </li>
  16. {% endfor %}
  17. </ul>
  18. </details>
  19. </li>
  20. {% for current_action in get_note_actions(note) %}
  21. <li>
  22. <a title="{{ current_action["title"] | trans }}" class="{{ current_action["classes"] }}"
  23. href="{{ current_action["url"] }}"></a>
  24. </li>
  25. {% endfor %}
  26. </ul>
  27. </div>
  28. {% endif %}
  29. {% endblock note_actions %}
  30. {% block note_replies %}
  31. {% if replies is defined and replies is not empty %}
  32. <div class="u-in-reply-to replies" tabindex="0" title="{{ 'Begin replies to ' | trans }}{{ nickname }}{{ '\'s note!' | trans }}">
  33. <strong>{{ 'Replies to ' | trans }}{{ nickname }}</strong>
  34. {% for conversation in replies %}
  35. {{ _self.macro_note(conversation['note'], conversation['replies']) }}
  36. <hr tabindex="0" title="{{ 'End of reply' | trans }}">
  37. {% endfor %}
  38. </div>
  39. {% endif %}
  40. {% endblock note_replies %}
  41. {% block note_attachments %}
  42. {% if hide_attachments is not defined %}
  43. {% if note.getAttachments() is not empty %}
  44. <section class="note-attachments" tabindex="0" title="{{ 'Note attachments.' | trans }}">
  45. {% for attachment in note.getAttachments() %}
  46. {% include '/cards/attachments/view.html.twig' with {'attachment': attachment, 'note': note} only%}
  47. {% endfor %}
  48. </section>
  49. {% endif %}
  50. {% endif %}
  51. {% endblock note_attachments %}
  52. {% block note_links %}
  53. {% if note.getLinks() is not empty %}
  54. <div class="note-links" title="{{ 'Shared links.' | trans }}">
  55. {% for link in note.getLinks() %}
  56. {% for block in handle_event('ViewLink', {'link': link, 'note': note}) %}
  57. {{ block | raw }}
  58. {% endfor %}
  59. {% endfor %}
  60. </div>
  61. {% endif %}
  62. {% endblock note_links %}
  63. {% block note_text %}
  64. <div class="note-text" tabindex="0" title="{{ 'Note text content.' | trans }}">
  65. {{ note.getRendered() | raw }}
  66. </div>
  67. {% endblock note_text %}
  68. {% block note_author %}
  69. {# Microformat's h-card properties indicates a face icon is a "u-logo" #}
  70. <header class="note-author-fullname" tabindex="0" title="{{ 'Begin a note by the user: ' | trans }} {{ nickname }}" >
  71. {% if fullname is not null %}
  72. {{ fullname }}
  73. {% else %}
  74. {{ nickname }}
  75. {% endif %}
  76. </header>
  77. <a href="{{ actor_url }}" class="note-author-url u-url">
  78. <em class="note-author-nickname">{{ nickname }}</em>
  79. </a>
  80. {% endblock note_author %}
  81. {% block note_sidebar %}
  82. <aside class="note-sidebar">
  83. <img class="u-logo avatar" src="{{ note.getActorAvatarUrl() }}" alt="{{ nickname }}'s avatar" width="32px" height="32px">
  84. </aside>
  85. {% endblock note_sidebar %}
  86. {% block note_info %}
  87. <div class="note-info">
  88. {{ block('note_author') }}
  89. <em>
  90. <a href="{{ note.getUrl() }}" class="note-url">{{ 'in conversation' | trans }} {{ note.getModified() | ago }}</a>
  91. </em>
  92. {{ block('note_actions') }}
  93. </div>
  94. {% endblock note_info %}
  95. {% macro macro_note(note, replies) %}
  96. {% set nickname = note.getActorNickname() %}
  97. {% set fullname = note.getActorFullname() %}
  98. {% set actor = note.getActor() %}
  99. {% set actor_url = actor.getUrl() %}
  100. {% set note_language = note.getNoteLanguageShortDisplay() %}
  101. <article class="h-entry hentry note" lang={{ note.getLanguageLocale() }}>
  102. {{ block('note_sidebar') }}
  103. <div class="note-wrapper">
  104. {{ block('note_info') }}
  105. <section role="dialog" class="e-content entry-content note-content">
  106. {{ block('note_text') }}
  107. {{ block('note_attachments') }}
  108. {{ block('note_links') }}
  109. </section>
  110. {{ block('note_replies') }}
  111. {% for block in handle_event('AppendCardNote', {'note': note, 'actor': note.getActor() }) %}
  112. <aside title="{{ 'Note\'s complementary information' | trans }}" class="note-complementary">
  113. {{ block | raw }}
  114. </aside>
  115. {% endfor %}
  116. {# {% if note_language is defined and note_language is not empty %}#}
  117. {# <div title="{{ 'Note\'s language' | trans }}" class="h-entry-language">{{ note_language }}</div>#}
  118. {# {% endif %}#}
  119. </div>
  120. </article>
  121. {% endmacro macro_note %}
  122. {% macro macro_note_minimal(note) %}
  123. {% set nickname = note.getActorNickname() %}
  124. {% set fullname = note.getActorFullname() %}
  125. {% set actor_url = note.getActor().getUrl() %}
  126. <article class="h-entry hentry note">
  127. {{ block('note_sidebar') }}
  128. <div class="note-wrapper">
  129. <div tabindex="0" title="{{ 'Begin a note by the user: ' | trans }} {{ nickname }}." class="note-info">
  130. {{ block('note_author') }}
  131. </div>
  132. <section tabindex="0" role="dialog" class="e-content entry-content note-content">
  133. {{ block('note_text') }}
  134. {{ block('note_attachments') }}
  135. {{ block('note_links') }}
  136. </section>
  137. </div>
  138. </article>
  139. {% endmacro macro_note_minimal %}