post.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. {% load i18n misago_avatars %}
  2. <div id="post-{{ post.pk }}" class="media post thread-post{% if post.poster_id and post.poster.rank.css_class %} rank-{{ post.poster.rank.css_class }}{% endif %}" data-id="{{ post.pk }}" data-edit-url="{{ post.get_edit_url }}" data-quote-url="{{ post.get_quote_url }}">
  3. {% if post.poster %}
  4. <a class="user-avatar pull-left" href="{% url USER_PROFILE_URL user_slug=post.poster.slug user_id=post.poster.id %}">
  5. <img class="media-object" src="{{ post.poster|avatar:100 }}" alt="{% trans "Poster avatar" %}">
  6. </a>
  7. {% else %}
  8. <span class="user-avatar pull-left">
  9. <img class="media-object" src="{% blankavatar 100 %}" alt="{% trans "Poster avatar" %}">
  10. </span>
  11. {% endif %}
  12. <div class="media-body">
  13. <div class="panel panel-default">
  14. <div class="panel-heading">
  15. {% if post.poster %}
  16. {% include "misago/user_state.html" with user=post.poster state=post.poster.online_state %}
  17. <a class="user-name" href="{% url USER_PROFILE_URL user_slug=post.poster.slug user_id=post.poster.id %}">
  18. {{ post.poster }}</a>
  19. {% if post.poster.short_title %}
  20. <span class="label user-rank">{{ post.poster.short_title }}</span>
  21. {% endif %}
  22. {% else %}
  23. <span class="fa fa-power-off fa-fw user-offline tooltip-top" title="{% blocktrans with user=post.poster_name %}{{ user }}'s forum account has been deleted.{% endblocktrans %}"></span>
  24. <span class="user-name">
  25. {{ post.poster_name }}
  26. </span>
  27. {% endif %}
  28. <span class="separator">&ndash;</span>
  29. <a href="{{ post.get_absolute_url }}" class="post-date tooltip-top dynamic time-ago" title="{{ post.posted_on }}" data-timestamp="{{ post.posted_on|date:"c" }}">
  30. {{ post.posted_on|date }}
  31. </a>
  32. {% if post.is_protected %}
  33. <span class="fa fa-lock tooltip-top" title="{% trans "This post is protected from being changed by its author." %}"></span>
  34. {% endif %}
  35. {% if not post.is_read %}
  36. <span class="label label-success">
  37. <span class="fa fa-plus-circle"></span>
  38. {% trans "New" %}
  39. </span>
  40. {% endif %}
  41. {% if posts_actions %}
  42. <a href="#" class="post-check">
  43. <span class="fa fa-check"></span>
  44. <input type="checkbox" form="posts-actions" name="item" value="{{ post.pk }}"{% if post.pk in selected_posts %}checked="checked"{% endif %}>
  45. </a>
  46. {% endif %}
  47. <a href="{{ post.get_absolute_url }}" class="pull-right post-date tooltip-top" title="{% trans "Link to this post" %}">
  48. #{{ page.start_index|add:forloop.counter0 }}
  49. </a>
  50. </div>
  51. {% if post.is_moderated %}
  52. <div class="alert alert-info">
  53. <span class="fa fa-question-circle fa-fw fa-lg"></span>
  54. {% if post.id == thread.first_post_id %}
  55. {% trans "This thread won't be visible to other users until its approved by moderator." %}
  56. {% else %}
  57. {% trans "This post won't be visible to other users until its approved by moderator." %}
  58. {% endif %}
  59. </div>
  60. {% endif %}
  61. {% if post.is_reported %}
  62. <div class="alert alert-danger">
  63. <span class="fa fa-exclamation-triangle fa-fw fa-lg"></span>
  64. {% trans "This post was reported to moderators." %}
  65. </div>
  66. {% endif %}
  67. {% if post.is_hidden and post.acl.can_see_hidden %}
  68. <div class="alert alert-default">
  69. {% include "misago/thread/hidden_message.html" %}
  70. </div>
  71. {% endif %}
  72. {% if not post.is_hidden or post.acl.can_see_hidden %}
  73. {% if post.is_valid %}
  74. <div class="panel-body">
  75. <article class="post-body misago-markup">
  76. {{ post.parsed|safe }}
  77. <article>
  78. </div>
  79. {% else %}
  80. <div class="alert alert-danger">
  81. <span class="fa fa-exclamation-triangle fa-fw fa-lg"></span>
  82. {% trans "Post can't be displayed due to invalid message checksum." %}
  83. </div>
  84. {% endif %}
  85. <div class="panel-footer">
  86. {% if thread.acl.can_reply %}
  87. <button type="button" class="btn btn-reply btn-primary btn-flat pull-right">
  88. <span class="fa fa-reply">
  89. {% trans "Reply" %}
  90. </button>
  91. {% endif %}
  92. {% if post.acl.can_edit %}
  93. <button type="button" class="btn btn-edit btn-default btn-flat pull-right">
  94. <span class="fa fa-pencil">
  95. {% trans "Edit" %}
  96. </button>
  97. {% endif %}
  98. {% if post.acl.can_unhide %}
  99. <form action="{% url 'misago:unhide_post' post_id=post.id %}" method="post">
  100. {% csrf_token %}
  101. <button type="submit" class="btn btn-default btn-flat pull-right">
  102. <span class="fa fa-eye">
  103. {% trans "Reveal" %}
  104. </button>
  105. </form>
  106. {% endif %}
  107. {% if post.acl.can_hide %}
  108. <form action="{% url 'misago:hide_post' post_id=post.id %}" method="post">
  109. {% csrf_token %}
  110. <button type="submit" class="btn btn-warning btn-flat pull-right">
  111. <span class="fa fa-eye-slash">
  112. {% trans "Hide" %}
  113. </button>
  114. </form>
  115. {% endif %}
  116. {% if post.acl.can_delete %}
  117. <form action="{% url 'misago:delete_post' post_id=post.id %}" method="post" data-prompt="{% trans "Are you sure you want to delete this post?" %}">
  118. {% csrf_token %}
  119. <button type="submit" class="btn btn-danger btn-flat pull-right">
  120. <span class="fa fa-times">
  121. {% trans "Delete" %}
  122. </button>
  123. </form>
  124. {% endif %}
  125. <form action="" method="post">
  126. {% csrf_token %}
  127. <button type="submit" class="btn btn-warning btn-flat pull-right">
  128. <span class="fa fa-exclamation-triangle">
  129. {% trans "Report" %}
  130. </button>
  131. </form>
  132. {% if post.acl.can_approve %}
  133. <form action="{% url 'misago:approve_post' post_id=post.id %}" method="post">
  134. {% csrf_token %}
  135. <button type="submit" class="btn btn-success btn-flat pull-right">
  136. <span class="fa fa-check">
  137. {% trans "Approve" %}
  138. </button>
  139. </form>
  140. {% endif %}
  141. <form action="" method="post">
  142. {% csrf_token %}
  143. <button type="submit" class="btn btn-success btn-flat pull-left">
  144. <span class="fa fa-heart">
  145. {% trans "Like" %}
  146. </button>
  147. </form>
  148. </div>
  149. {% else %}
  150. <div class="panel-body">
  151. <p class="hidden-message lead text-muted">
  152. {% include "misago/thread/hidden_message.html" %}
  153. </p>
  154. </div>
  155. {% endif %}
  156. </div>
  157. {% if post.events %}
  158. {% include "misago/thread/events.html" %}
  159. {% endif %}
  160. </div>
  161. </div>