thread.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. {% extends "cranefly/layout.html" %}
  2. {% import "_forms.html" as form_theme with context %}
  3. {% import "cranefly/editor.html" as editor with context %}
  4. {% import "cranefly/macros.html" as macros with context %}
  5. {% block title %}{{ macros.page_title(title=thread.name,parent=forum.name,page=pagination['page']) }}{% endblock %}
  6. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  7. <li><a href="{% url 'reports' %}">{% trans %}Reported Posts{% endtrans %}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  8. <li class="active">{{ thread.name }}
  9. {%- endblock %}
  10. {% block container %}
  11. <div class="page-header header-primary">
  12. <div class="container">
  13. {{ messages_list(messages) }}
  14. <ul class="breadcrumb" {{ macros.itemprop_bread() }}>
  15. {{ self.breadcrumb() }}</li>
  16. </ul>
  17. <h1>{{ thread.name }}</h1>
  18. <ul class="unstyled header-stats">
  19. <li><i class="icon-tag"></i> {% if thread.weight == 2 -%}
  20. {% trans %}Open{% endtrans %}
  21. {%- elif thread.weight == 1 -%}
  22. Resolved
  23. {%- else -%}
  24. Bogus
  25. {%- endif %}</li>
  26. <li><i class="icon-time"></i> {{ thread.last|reltimesince }}</li>
  27. <li><i class="icon-user"></i> {% if thread.start_poster_id %}<a href="{% url 'user' user=thread.start_poster_id, username=thread.start_poster_slug %}">{{ thread.start_poster_name }}</a>{% else %}{{ thread.start_poster_name }}{% endif %}</li>
  28. <li><i class="icon-comment"></i> {% if thread.replies > 0 -%}
  29. {% trans count=thread.replies, replies=thread.replies|intcomma %}One comment{% pluralize %}{{ replies }} comments{% endtrans %}
  30. {%- else -%}
  31. {% trans %}No comments{% endtrans %}
  32. {%- endif %}</li>
  33. </ul>
  34. </div>
  35. </div>
  36. <div class="container container-primary report-view">
  37. {% if message %}
  38. <div class="messages-list">
  39. {{ macros.draw_message(message) }}
  40. </div>
  41. {% endif %}
  42. <div class="thread-buttons">
  43. {{ pager() }}
  44. <a href="{% url 'report_reply' thread=thread.pk, slug=thread.slug %}" class="btn btn-inverse pull-right"><i class="icon-pencil"></i> {% trans %}Comment{% endtrans %}</a>
  45. {% if watcher %}
  46. <form action="{% url 'report_unwatch' thread=thread.pk, slug=thread.slug %}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn btn-success tooltip-top" title="{% trans %}Remove thread from watched list{% endtrans %}"><i class="icon-bookmark"></i></button></form>
  47. {% if watcher.email %}
  48. <form action="{% url 'report_unwatch_email' thread=thread.pk, slug=thread.slug %}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn btn-success tooltip-top" title="{% trans %}Don't e-mail me anymore if anyone replies to this thread{% endtrans %}"><i class="icon-envelope"></i></button></form>
  49. {% else %}
  50. <form action="{% url 'report_watch_email' thread=thread.pk, slug=thread.slug %}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn tooltip-top" title="{% trans %}E-mail me if anyone replies{% endtrans %}"><i class="icon-envelope"></i></button></form>
  51. {% endif %}
  52. {% else %}
  53. <form action="{% url 'report_watch' thread=thread.pk, slug=thread.slug %}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn tooltip-top" title="{% trans %}Add thread to watched list{% endtrans %}"><i class="icon-bookmark"></i></button></form>
  54. <form action="{% url 'report_watch_email' thread=thread.pk, slug=thread.slug %}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn tooltip-top" title="{% trans %}Add thread to watched list and e-mail me if anyone replies{% endtrans %}"><i class="icon-envelope"></i></button></form>
  55. {% endif %}
  56. </div>
  57. <div class="thread-body">
  58. {% if thread.start_post_id != posts[0].pk %}
  59. {% set posts = (posts|list) %}
  60. {% do posts.insert(0, thread.start_post) %}
  61. {% endif %}
  62. {% for post in posts %}
  63. <div id="post-{{ post.pk }}" class="post-wrapper{% if post.pk == thread.start_post_id %} report-wrapper{% endif %}">
  64. {% if post.message %}
  65. <div class="messages-list">
  66. {{ macros.draw_message(post.message) }}
  67. </div>
  68. {% endif %}
  69. {% if post.deleted and not acl.threads.can_see_deleted_posts(forum) %}
  70. <div class="post-body post-muted">
  71. {% if post.user_id %}
  72. <a href="{% url 'user' user=post.user.pk, username=post.user.username_slug %}"><img src="{{ post.user.get_avatar(50) }}" alt="" class="user-avatar"></a>
  73. {% else %}
  74. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar">
  75. {% endif %}
  76. <div class="post-content">
  77. <div class="post-header">
  78. <div class="post-header-compact">
  79. {% if post.user_id %}
  80. <a href="{% url 'user' user=post.user.pk, username=post.user.username_slug %}" class="post-author">{{ post.user.username }}</a>{% if post.user.get_title() %} {{ user_label(post.user) }}{% endif %}
  81. {% else %}
  82. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  83. {% endif %}
  84. <span class="separator">&ndash;</span>
  85. <a href="{% url 'report_find' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-date">{{ post.date|reltimesince }}</a>
  86. {% if post.edits %}
  87. <span class="separator">&ndash;</span>
  88. {% if acl.threads.can_see_changelog(user, forum, post) %}
  89. <a href="{% url 'report_changelog' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-changelog tooltip-bottom" title="{% trans %}Show changelog{% endtrans %}">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</a>
  90. {% else %}
  91. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  92. {% endif %}
  93. {% endif %}
  94. </div>
  95. <a href="{% url 'report_find' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  96. {% if not post.is_read %}
  97. <div class="post-extra">
  98. <span class="label label-warning">
  99. {% trans %}New{% endtrans %}
  100. </span>
  101. </div>
  102. {% endif %}
  103. </div>
  104. <div class="post-message">
  105. {% trans user=edit_user(post), date=post.delete_date|reltimesince|low %}{{ user }} has deleted this reply {{ date }}{% endtrans %}
  106. </div>
  107. </dv>
  108. </div>
  109. {% else %}
  110. <div class="post-body">
  111. {% if post.user_id %}
  112. <a href="{% url 'user' user=post.user.pk, username=post.user.username_slug %}"><img src="{{ post.user.get_avatar(100) }}" alt="" class="user-avatar"></a>
  113. {% else %}
  114. <img src="{{ macros.avatar_guest(100) }}" alt="" class="user-avatar">
  115. {% endif %}
  116. <div class="post-arrow"></div>
  117. <div class="post-content">
  118. <div class="post-header">
  119. {% if post.user_id %}
  120. <a href="{% url 'user' user=post.user.pk, username=post.user.username_slug %}" class="post-author">{{ post.user.username }}</a>{% if post.user.get_title() %} {{ user_label(post.user) }}{% endif %}
  121. {% else %}
  122. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  123. {% endif %}
  124. <span class="separator">&ndash;</span>
  125. <a href="{% url 'report_find' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-date">{{ post.date|reltimesince }}</a>
  126. {% if post.edits %}
  127. <span class="separator">&ndash;</span>
  128. {% if acl.threads.can_see_changelog(user, forum, post) %}
  129. <a href="{% url 'report_changelog' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-changelog tooltip-bottom" title="{% trans %}Show changelog{% endtrans %}">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</a>
  130. {% else %}
  131. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  132. {% endif %}
  133. {% endif %}
  134. {% if posts_form and thread.start_post_id != post.pk %}
  135. <label class="checkbox post-checkbox"><input form="posts_form" name="{{ posts_form['list_items']['html_name'] }}" type="checkbox" class="checkbox-member" value="{{ post.pk }}"{% if posts_form['list_items']['has_value'] and ('' ~ post.pk) in posts_form['list_items']['value'] %} checked="checked"{% endif %}></label>
  136. {% endif %}
  137. {% if posts_form and thread.start_post_id == post.pk %}
  138. <a href="{% url 'report_find' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#1</i></a>
  139. {% else %}
  140. <a href="{% url 'report_find' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index0 }}</a>
  141. {% endif %}
  142. <div class="post-extra">
  143. {% if post.protected and acl.threads.can_protect(forum) %}
  144. <span class="label label-info">
  145. {% trans %}Protected{% endtrans %}
  146. </span>
  147. {% endif %}
  148. {% if post.deleted %}
  149. <span class="label label-inverse">
  150. {% trans %}Deleted{% endtrans %}
  151. </span>
  152. {% endif %}
  153. {% if not post.is_read %}
  154. <span class="label label-warning">
  155. {% trans %}New{% endtrans %}
  156. </span>
  157. {% endif %}
  158. </div>
  159. </div>
  160. <div class="post-message">
  161. <div class="markdown js-extra">
  162. <article>
  163. {{ post.post_preparsed|markdown_final|safe }}
  164. </article>
  165. </div>
  166. </div>
  167. <div class="post-footer">{% filter trim %}
  168. {% if post.pk == thread.start_post_id %}
  169. <div class="post-actions report-actions">
  170. {% if thread.weight == 2 %}
  171. <form action="{{ request_path }}" class="form-inline" method="post">
  172. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  173. <input type="hidden" name="origin" value="thread_form">
  174. <input type="hidden" name="thread_action" value="sticky">
  175. <button type="submit" class="btn btn-link btn-resolve tooltip-top" title="{% trans %}Set this report as resolved{% endtrans %}"><i class="icon-ok"></i> {% trans %}Resolved{% endtrans %}</button>
  176. </form>
  177. <form action="{{ request_path }}" class="form-inline" method="post">
  178. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  179. <input type="hidden" name="origin" value="thread_form">
  180. <input type="hidden" name="thread_action" value="normal">
  181. <button type="submit" class="btn btn-link btn-bogus tooltip-top" title="{% trans %}Set this report as bogus{% endtrans %}"><i class="icon-remove"></i> {% trans %}Bogus{% endtrans %}</button>
  182. </form>
  183. {% elif thread.weight != 1 %}
  184. <form action="{{ request_path }}" class="form-inline" method="post">
  185. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  186. <input type="hidden" name="origin" value="thread_form">
  187. <input type="hidden" name="thread_action" value="normal">
  188. <button type="submit" class="btn btn-link btn-resolve tooltip-top" title="{% trans %}Set this report as bogus{% endtrans %}"><i class="icon-ok"></i> {% trans %}Resolved{% endtrans %}</button>
  189. </form>
  190. {% elif thread.weight != 0 %}
  191. <form action="{{ request_path }}" class="form-inline" method="post">
  192. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  193. <input type="hidden" name="origin" value="thread_form">
  194. <input type="hidden" name="thread_action" value="sticky">
  195. <button type="submit" class="btn btn-link btn-bogus tooltip-top" title="{% trans %}Set this report as resolved{% endtrans %}"><i class="icon-remove"></i> {% trans %}Bogus{% endtrans %}</button>
  196. </form>
  197. {% endif %}
  198. </div>
  199. {% endif %}
  200. <div class="post-actions">
  201. {% if acl.users.can_see_users_trails() -%}
  202. <a href="{% url 'report_post_info' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-trail">{% trans %}Info{% endtrans %}</a>
  203. {% endif %}
  204. {% if acl.threads.can_edit_thread(user, forum, thread, post) and thread.start_post_id == post.pk %}
  205. <a href="{% url 'report_edit' thread=thread.pk, slug=thread.slug %}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  206. {% elif acl.threads.can_edit_reply(user, forum, thread, post) %}
  207. <a href="{% url 'report_post_edit' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  208. {%- endif %}
  209. <a href="{% url 'report_reply' thread=thread.pk, slug=thread.slug, quote=post.pk %}" class="post-reply">{% trans %}Reply{% endtrans %}</a>
  210. </div>
  211. {% if post.pk == thread.start_post_id %}
  212. <div class="post-actions">
  213. {% if acl.threads.can_delete_thread(user, forum, thread, post) %}
  214. {% if post.deleted %}
  215. <form action="{% url 'report_show' thread=thread.pk, slug=thread.slug %}" class="form-inline" method="post">
  216. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  217. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Make this thread visible to other users{% endtrans %}">{% trans %}Restore{% endtrans %}</button>
  218. </form>
  219. {% else %}
  220. <form action="{% url 'report_hide' thread=thread.pk, slug=thread.slug %}" class="form-inline" method="post">
  221. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  222. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Hide this thread from other users{% endtrans %}">{% trans %}Hide{% endtrans %}</button>
  223. </form>
  224. {% endif %}
  225. {% endif %}
  226. {% if acl.threads.can_delete_thread(user, forum, thread, post) == 2 %}
  227. <form action="{% url 'report_delete' thread=thread.pk, slug=thread.slug %}" class="form-inline prompt-delete-thread" method="post">
  228. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  229. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this thread for good{% endtrans %}">{% trans %}Delete{% endtrans %}</button>
  230. </form>
  231. {% endif %}
  232. </div>
  233. {% elif post.pk != thread.start_post_id and acl.threads.can_delete_post(user, forum, thread, post) %}
  234. <div class="post-actions">
  235. {% if acl.threads.can_delete_post(user, forum, thread, post) %}
  236. {% if post.deleted %}
  237. <form action="{% url 'report_post_show' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="form-inline" method="post">
  238. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  239. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Make this reply visible to other users{% endtrans %}">{% trans %}Restore{% endtrans %}</button>
  240. </form>
  241. {% else %}
  242. <form action="{% url 'report_post_hide' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="form-inline" method="post">
  243. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  244. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Hide this reply from other users{% endtrans %}">{% trans %}Hide{% endtrans %}</button>
  245. </form>
  246. {% endif %}
  247. {% endif %}
  248. {% if acl.threads.can_delete_post(user, forum, thread, post) == 2 -%}
  249. <form action="{% url 'report_post_delete' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="form-inline prompt-delete-post" method="post">
  250. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  251. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this reply for good{% endtrans %}">{% trans %}Delete{% endtrans %}</button>
  252. </form>
  253. {% endif %}
  254. </div>
  255. {% endif %}
  256. {% endfilter %}</div>
  257. </div>
  258. </div>
  259. {% endif %}
  260. </div>
  261. {% if post.checkpoints_visible %}
  262. <div class="post-checkpoints">
  263. {% for checkpoint in post.checkpoints_visible %}
  264. <div class="post-checkpoint{% if checkpoint.deleted %} checkpoint-deleted{% endif %}">
  265. <hr>
  266. <span>
  267. {%- if checkpoint.action == 'limit' -%}
  268. <i class="icon-lock"></i> {% trans %}This thread has reached its post limit and has been closed.{% endtrans %}
  269. {%- elif checkpoint.action == 'resolved' -%}
  270. <i class="icon-ok"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} has set this report as resolved {{ date }}{% endtrans %}
  271. {%- elif checkpoint.action == 'bogus' -%}
  272. <i class="icon-remove"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} has set this report as bogus {{ date }}{% endtrans %}
  273. {%- elif checkpoint.action == 'reported' -%}
  274. <i class="icon-fire"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} has also reported this post {{ date }}{% endtrans %}
  275. {%- elif checkpoint.action == 'deleted' -%}
  276. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} deleted this thread {{ date }}{% endtrans %}
  277. {%- elif checkpoint.action == 'undeleted' -%}
  278. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} restored this thread {{ date }}{% endtrans %}
  279. {%- endif -%}
  280. {% if acl.threads.can_delete_checkpoint(forum) %}
  281. {% if checkpoint.deleted %}
  282. <form action="{% url 'report_post_checkpoint_show' slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk %}" method="post" class="form-inline">
  283. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  284. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  285. <button type="submit" class="btn btn-link btn-show">{% trans %}Restore{% endtrans %}</button>
  286. </form>
  287. {% else %}
  288. <form action="{% url 'report_post_checkpoint_hide' slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk %}" method="post" class="form-inline">
  289. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  290. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  291. <button type="submit" class="btn btn-link btn-hide">{% trans %}Hide{% endtrans %}</button>
  292. </form>
  293. {% endif %}
  294. {% endif %}
  295. {% if acl.threads.can_delete_checkpoint(forum) == 2 %}
  296. <form action="{% url 'report_post_checkpoint_delete' slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk %}" method="post" class="form-inline prompt-delete-checkpoint">
  297. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  298. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  299. <button type="submit" class="btn btn-link btn-delete">{% trans %}Delete{% endtrans %}</button>
  300. </form>
  301. {% endif %}
  302. </span>
  303. </div>
  304. {% endfor %}
  305. </div>
  306. {% endif %}
  307. {% endfor %}
  308. </div>
  309. {% if thread_form or posts_form %}
  310. <div class="thread-moderation">
  311. <form id="thread_form" class="form-inline pull-left" action="{{ request_path }}" method="POST">
  312. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  313. <input type="hidden" name="origin" value="thread_form">
  314. {{ form_theme.input_select(thread_form['thread_action'],width=3) }}
  315. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  316. </form>
  317. {% if posts_form%}
  318. <form id="posts_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  319. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  320. <input type="hidden" name="origin" value="posts_form">
  321. {{ form_theme.input_select(posts_form['list_action'],width=3) }}
  322. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  323. </form>
  324. {% endif %}
  325. </div>
  326. {% endif %}
  327. <div class="thread-buttons">
  328. {{ pager(false) }}
  329. <a href="{% url 'report_reply' thread=thread.pk, slug=thread.slug %}" class="btn btn-inverse pull-right"><i class="icon-pencil"></i> {% trans %}Comment{% endtrans %}</a>
  330. </div>
  331. <div class="thread-quick-reply">
  332. <form action="{% url 'report_reply' thread=thread.pk, slug=thread.slug %}" method="post">
  333. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  334. <input type="hidden" name="quick_reply" value="1">
  335. <img src="{{ user.get_avatar(100) }}" alt="{% trans %}Your Avatar{% endtrans %}" class="user-avatar">
  336. {{ editor.editor(quick_reply.post, _('Post Comment'), extra=editor_extra()) }}
  337. </form>
  338. </div>
  339. </div>
  340. {% endblock %}
  341. {% block stylesheets %}{{ super() }}
  342. <link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
  343. {% endblock %}
  344. {% block javascripts -%}{{ super() }}
  345. <script src="{{ STATIC_URL }}cranefly/highlight/highlight.pack.js"></script>
  346. <script type="text/javascript">
  347. hljs.tabReplace = ' ';
  348. hljs.initHighlightingOnLoad();
  349. EnhancePostsMD();
  350. $(function () {
  351. $('#thread_form').submit(function() {
  352. if ($('#id_thread_action').val() == 'hard') {
  353. var decision = confirm("{% trans %}Are you sure you want to delete this report? This action is not reversible!{% endtrans %}");
  354. return decision;
  355. }
  356. return true;
  357. });
  358. $('#posts_form').submit(function() {
  359. if ($('.post-checkbox[]:checked').length == 0) {
  360. alert("{% trans %}You have to select at least one comment.{% endtrans %}");
  361. return false;
  362. }
  363. if ($('#id_list_action').val() == 'hard') {
  364. var decision = confirm("{% trans %}Are you sure you want to delete selected comments? This action is not reversible!{% endtrans %}");
  365. return decision;
  366. }
  367. return true;
  368. });
  369. $('.prompt-delete-thread').submit(function() {
  370. var decision = confirm("{% trans %}Are you sure you want to delete this report?{% endtrans %}");
  371. return decision;
  372. });
  373. $('.prompt-delete-post').submit(function() {
  374. var decision = confirm("{% trans %}Are you sure you want to delete this comment?{% endtrans %}");
  375. return decision;
  376. });
  377. $('.prompt-delete-checkpoint').submit(function() {
  378. var decision = confirm("{% trans %}Are you sure you want to delete this checkpoint?{% endtrans %}");
  379. return decision;
  380. });
  381. });
  382. </script>
  383. {{ editor.js() }}
  384. {%- endblock %}
  385. {% macro user_label(user) -%}
  386. <{% if user.rank and user.rank.as_tab %}a href="{% url 'users' slug=user.rank.slug %}"{% else %}span{% endif %} class="label post-author-label{% if user.rank and user.rank.style %} post-label-{{ user.rank.style }}{% endif %}">{{ user.get_title() }}</{% if user.rank and user.rank.as_tab%}a{% else %}span{% endif %}>
  387. {%- endmacro %}
  388. {% macro pager(extra=true) %}
  389. <div class="pagination pull-left">
  390. <ul>
  391. {% if pagination['total'] > 0 %}
  392. <li class="count">{{ macros.pager_label(pagination) }}</li>
  393. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'report' slug=thread.slug, thread=thread.id %}" class="tooltip-top" title="{% trans %}Go to first page{% endtrans %}"><i class="icon-chevron-left"></i> {% trans %}First{% endtrans %}</a></li>{% endif -%}
  394. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'report' slug=thread.slug, thread=thread.id, page=pagination['prev'] %}{% else %}{% url 'report' slug=thread.slug, thread=thread.id %}{% endif %}" class="tooltip-top" title="{% trans %}Older Posts{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  395. {%- if pagination['next'] > 0 %}<li><a href="{% url 'report' slug=thread.slug, thread=thread.id, page=pagination['next'] %}" class="tooltip-top" title="{% trans %}Newest Posts{% endtrans %}"><i class="icon-chevron-right"></i></a></li>{% endif -%}
  396. {%- if pagination['next'] > 0 and pagination['next'] < pagination['total'] %}<li><a href="{% url 'report' slug=thread.slug, thread=thread.id, page=pagination['total'] %}" class="tooltip-top" title="{% trans %}Go to last page{% endtrans %}">{% trans %}Last{% endtrans %} <i class="icon-chevron-right"></i></a></li>{% endif -%}
  397. {% endif %}
  398. {% if extra %}
  399. {% if not is_read %}<li><a href="{% url 'report_new' slug=thread.slug, thread=thread.id %}" class="tooltip-top" title="{% trans %}Go to first unread{% endtrans %}"><i class="icon-star"></i> {% trans %}First Unread{% endtrans %}</a></li>{% endif %}
  400. {% endif %}
  401. </ul>
  402. </div>
  403. {% endmacro %}
  404. {% macro checkpoint_user(checkpoint) -%}
  405. {%- if checkpoint.user_id -%}
  406. <a href="{{ 'user'|url(user=checkpoint.user_id, username=checkpoint.user_slug) }}">{{ checkpoint.user_name }}</a>
  407. {%- else -%}
  408. <strong>{{ checkpoint.user_name }}</strong>
  409. {%- endif -%}
  410. {%- endmacro %}
  411. {% macro checkpoint_forum(checkpoint) -%}
  412. {%- if checkpoint.old_forum_id -%}
  413. <a href="{% url 'forum' forum=checkpoint.old_forum_id, slug=checkpoint.old_forum_slug %}">{{ checkpoint.old_forum_name }}</a>
  414. {%- else -%}
  415. <strong>{{ checkpoint.old_forum_name }}</strong>
  416. {%- endif -%}
  417. {%- endmacro %}
  418. {% macro edit_user(post) -%}
  419. {%- if post.edit_user_id -%}
  420. <a href="{{ 'user'|url(user=post.edit_user_id, username=post.edit_user_slug) }}">{{ post.edit_user_name }}</a>
  421. {%- else -%}
  422. <strong>{{ post.edit_user_name }}</strong>
  423. {%- endif -%}
  424. {%- endmacro %}
  425. {% macro editor_extra() %}
  426. <button id="editor-preview" name="preview" type="submit" class="btn pull-right">{% trans %}Full Editor{% endtrans %}</button>
  427. {% endmacro %}