post.html 6.4 KB

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