thread.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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=_("Private Threads"),page=pagination['page']) }}{% endblock %}
  6. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  7. <li><a href="{% url 'private_threads' %}">{% trans %}Private Threads{% 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. {% if thread.moderated %}<li><i class="icon-eye-close"></i> {% trans %}Not Reviewed{% endtrans %}</li>{% endif %}
  20. <li><i class="icon-time"></i> {{ thread.last|reltimesince }}</li>
  21. <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>
  22. <li><i class="icon-comment"></i> {% if thread.replies > 0 -%}
  23. {% trans count=thread.replies, replies=thread.replies|intcomma %}One reply{% pluralize %}{{ replies }} replies{% endtrans %}
  24. {%- else -%}
  25. {% trans %}No replies{% endtrans %}
  26. {%- endif %}</li>
  27. </ul>
  28. </div>
  29. </div>
  30. <div class="container container-primary">
  31. {% if message %}
  32. <div class="messages-list">
  33. {{ macros.draw_message(message) }}
  34. </div>
  35. {% endif %}
  36. <div class="thread-buttons">
  37. {{ pager() }}
  38. {% if acl.threads.can_reply(forum, thread) %}
  39. <a href="{% url 'private_thread_reply' thread=thread.pk, slug=thread.slug %}" class="btn btn-inverse pull-right"><i class="icon-pencil"></i> {% trans %}Reply{% endtrans %}</a>
  40. {% endif %}
  41. {% if watcher %}
  42. <form action="{% url 'private_thread_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>
  43. {% if watcher.email %}
  44. <form action="{% url 'private_thread_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>
  45. {% else %}
  46. <form action="{% url 'private_thread_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>
  47. {% endif %}
  48. {% else %}
  49. <form action="{% url 'private_thread_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>
  50. <form action="{% url 'private_thread_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>
  51. {% endif %}
  52. {% if ignored_posts %}
  53. <form action="{% url 'private_thread_show_hidden' thread=thread.pk, slug=thread.slug %}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><button type="submit" class="btn"><i class="icon-eye-open"></i> {% trans %}Show Hidden Replies{% endtrans %}</button></form>
  54. {% endif %}
  55. </div>
  56. <div class="thread-body">
  57. {% for post in posts %}
  58. <div id="post-{{ post.pk }}" class="post-wrapper">
  59. {% if post.message %}
  60. <div class="messages-list">
  61. {{ macros.draw_message(post.message) }}
  62. </div>
  63. {% endif %}
  64. {% if post.deleted and not acl.threads.can_see_deleted_posts(forum) %}
  65. <div class="post-body post-muted">
  66. {% if post.user_id %}
  67. <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>
  68. {% else %}
  69. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar"></a>
  70. {% endif %}
  71. <div class="post-content">
  72. <div class="post-header">
  73. <div class="post-header-compact">
  74. {% if post.user_id %}
  75. <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 %}
  76. {% else %}
  77. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  78. {% endif %}
  79. <span class="separator">&ndash;</span>
  80. <a href="{% if pagination['page'] > 1 -%}
  81. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  82. {%- else -%}
  83. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  84. {%- endif %}#post-{{ post.pk }}" class="post-date">{{ post.date|reltimesince }}</a>
  85. {% if post.edits %}
  86. <span class="separator">&ndash;</span>
  87. {% if acl.threads.can_see_changelog(user, forum, post) %}
  88. <a href="{% url 'changelog' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-changelog tooltip-bottom" title="{% trans %}Show changelog{% endtrans %}">{% trans count=post.edits %}One edit{% pluralize %}{{ count }} edits{% endtrans %}</a>
  89. {% else %}
  90. <span class="post-changelog">{% trans count=post.edits %}One edit{% pluralize %}{{ count }} edits{% endtrans %}</span>
  91. {% endif %}
  92. {% endif %}
  93. </div>
  94. <a href="{% if pagination['page'] > 1 -%}
  95. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  96. {%- else -%}
  97. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  98. {%- endif %}#post-{{ post.pk }}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  99. {% if not post.is_read %}
  100. <div class="post-extra">
  101. <span class="label label-warning">
  102. {% trans %}New{% endtrans %}
  103. </span>
  104. </div>
  105. {% endif %}
  106. </div>
  107. <div class="post-message">
  108. {% trans user=edit_user(post), date=post.edit_date|reltimesince|low %}{{ user }} has deleted this reply {{ date }}{% endtrans %}
  109. </div>
  110. </dv>
  111. </div>
  112. {% elif post.ignored %}
  113. <div class="post-body post-muted">
  114. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar"></a>
  115. <div class="post-arrow"></div>
  116. <div class="post-content">
  117. <div class="post-header">
  118. <div class="post-header-compact">
  119. <a href="{% if pagination['page'] > 1 -%}
  120. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  121. {%- else -%}
  122. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  123. {%- endif %}#post-{{ post.pk }}" class="post-date">{{ post.date|reltimesince }}</a>
  124. </div>
  125. <a href="{% if pagination['page'] > 1 -%}
  126. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  127. {%- else -%}
  128. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  129. {%- endif %}#post-{{ post.pk }}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  130. {% if not post.is_read %}
  131. <div class="post-extra">
  132. <span class="label label-warning">
  133. {% trans %}New{% endtrans %}
  134. </span>
  135. </div>
  136. {% endif %}
  137. </div>
  138. <div class="post-message">
  139. {% trans %}This reply was posted by user that is on your ignored list.{% endtrans %}
  140. </div>
  141. </dv>
  142. </div>
  143. {% else %}
  144. <div class="post-body">
  145. {% if post.user_id %}
  146. <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>
  147. {% else %}
  148. <img src="{{ macros.avatar_guest(100) }}" alt="" class="user-avatar"></a>
  149. {% endif %}
  150. <div class="post-arrow"></div>
  151. <div class="post-content">
  152. <div class="post-header">
  153. {% if post.user_id %}
  154. <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 %}
  155. {% else %}
  156. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  157. {% endif %}
  158. <span class="separator">&ndash;</span>
  159. <a href="{% if pagination['page'] > 1 -%}
  160. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  161. {%- else -%}
  162. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  163. {%- endif %}#post-{{ post.pk }}" class="post-date">{{ post.date|reltimesince }}</a>
  164. {% if post.edits %}
  165. <span class="separator">&ndash;</span>
  166. {% if acl.threads.can_see_changelog(user, forum, post) %}
  167. <a href="{% url 'private_thread_changelog' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-changelog tooltip-bottom" title="{% trans %}Show changelog{% endtrans %}">{% trans count=post.edits %}One edit{% pluralize %}{{ count }} edits{% endtrans %}</a>
  168. {% else %}
  169. <span class="post-changelog">{% trans count=post.edits %}One edit{% pluralize %}{{ count }} edits{% endtrans %}</span>
  170. {% endif %}
  171. {% endif %}
  172. {% if posts_form %}
  173. <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>
  174. {% endif %}
  175. <a href="{% if pagination['page'] > 1 -%}
  176. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  177. {%- else -%}
  178. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  179. {%- endif %}#post-{{ post.pk }}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  180. <div class="post-extra">
  181. {% if post.protected and acl.threads.can_protect(forum) %}
  182. <span class="label label-info">
  183. {% trans %}Protected{% endtrans %}
  184. </span>
  185. {% endif %}
  186. {% if post.deleted %}
  187. <span class="label label-inverse">
  188. {% trans %}Deleted{% endtrans %}
  189. </span>
  190. {% endif %}
  191. {% if post.moderated %}
  192. <span class="label label-purple">
  193. {% trans %}Unreviewed{% endtrans %}
  194. </span>
  195. {% endif %}
  196. {% if post.reported %}
  197. <span class="label label-important">
  198. {% trans %}Reported{% endtrans %}
  199. </span>
  200. {% endif %}
  201. {% if not post.is_read %}
  202. <span class="label label-warning">
  203. {% trans %}New{% endtrans %}
  204. </span>
  205. {% endif %}
  206. </div>
  207. </div>
  208. <div class="post-message">
  209. <div class="markdown js-extra">
  210. {{ post.post_preparsed|markdown_final|safe }}
  211. </div>
  212. {% if post.user.signature %}
  213. <div class="post-signature">
  214. <div class="markdown">
  215. {{ post.user.signature_preparsed|markdown_final|safe }}
  216. </div>
  217. </div>
  218. {% endif %}
  219. </div>
  220. <div class="post-footer">{% filter trim %}
  221. <div class="post-actions">
  222. {% if acl.users.can_see_users_trails() -%}
  223. <a href="{% url 'private_post_info' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-trail">{% trans %}Info{% endtrans %}</a>
  224. {% endif %}
  225. {% if acl.threads.can_edit_thread(user, forum, thread, post) and thread.start_post_id == post.pk %}
  226. <a href="{% url 'private_thread_edit' thread=thread.pk, slug=thread.slug %}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  227. {% elif acl.threads.can_edit_reply(user, forum, thread, post) %}
  228. <a href="{% url 'private_post_edit' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  229. {%- endif %}
  230. {% if acl.threads.can_reply(forum, thread) %}<a href="{% url 'private_thread_reply' thread=thread.pk, slug=thread.slug, quote=post.pk %}" class="post-reply">{% trans %}Reply{% endtrans %}</a>{% endif %}
  231. </div>
  232. {% if post.pk == thread.start_post_id %}
  233. <div class="post-actions">
  234. {% if acl.threads.can_delete_thread(user, forum, thread, post) == 2 %}
  235. <form action="{% url 'private_thread_delete' thread=thread.pk, slug=thread.slug %}" class="form-inline prompt-delete-thread" method="post">
  236. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  237. <span>{% trans %}Delete thread:{% endtrans %}</span>
  238. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this thread for good{% endtrans %}">{% trans %}Hard{% endtrans %}</button>
  239. </form>
  240. {% endif %}
  241. {% if not post.deleted and acl.threads.can_delete_thread(user, forum, thread, post) %}
  242. <form action="{% url 'private_thread_hide' thread=thread.pk, slug=thread.slug %}" class="form-inline prompt-delete-thread" method="post">
  243. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Hide this thread from other users{% endtrans %}">{% trans %}Soft{% endtrans %}</button>
  244. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  245. </form>
  246. {% endif %}
  247. </div>
  248. {% elif post.pk != thread.start_post_id and acl.threads.can_delete_post(user, forum, thread, post) %}
  249. <div class="post-actions">
  250. {% if acl.threads.can_delete_post(user, forum, thread, post) == 2 -%}
  251. <form action="{% url 'private_post_delete' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="form-inline prompt-delete-post" method="post">
  252. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  253. <span>{% trans %}Delete reply:{% endtrans %}</span>
  254. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this reply for good{% endtrans %}">{% trans %}Hard{% endtrans %}</button>
  255. </form>
  256. {% endif %}
  257. {% if not post.deleted and acl.threads.can_delete_post(user, forum, thread, post) %}
  258. <form action="{% url 'private_post_hide' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="form-inline prompt-delete-post" method="post">
  259. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  260. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Hide this reply from other users{% endtrans %}">{% trans %}Soft{% endtrans %}</button>
  261. </form>
  262. {% endif %}
  263. </div>
  264. {% endif %}
  265. {% endfilter %}</div>
  266. </div>
  267. </div>
  268. {% endif %}
  269. </div>
  270. {% if post.checkpoint_set.all() %}
  271. <div class="post-checkpoints">
  272. {% for checkpoint in post.checkpoint_set.all() %}
  273. <div class="post-checkpoint">
  274. <hr>
  275. <span>
  276. {%- if checkpoint.action == 'limit' -%}
  277. <i class="icon-lock"></i> {% trans %}This thread has reached its post limit and has been closed.{% endtrans %}
  278. {%- elif checkpoint.action == 'accepted' -%}
  279. <i class="icon-ok"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} accepted this thread {{ date }}{% endtrans %}
  280. {%- elif checkpoint.action == 'closed' -%}
  281. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} closed this thread {{ date }}{% endtrans %}
  282. {%- elif checkpoint.action == 'opened' -%}
  283. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} opened this thread {{ date }}{% endtrans %}
  284. {%- elif checkpoint.action == 'deleted' -%}
  285. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} deleted this thread {{ date }}{% endtrans %}
  286. {%- elif checkpoint.action == 'undeleted' -%}
  287. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} restored this thread {{ date }}{% endtrans %}
  288. {%- endif -%}
  289. </span>
  290. </div>
  291. {% endfor %}
  292. </div>
  293. {% endif %}
  294. {% endfor %}
  295. </div>
  296. {% if thread_form or posts_form %}
  297. <div class="thread-moderation">
  298. {% if thread_form%}
  299. <form id="thread_form" class="form-inline pull-left" action="{% url 'private_thread' slug=thread.slug, thread=thread.id, page=pagination['page'] %}" method="POST">
  300. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  301. <input type="hidden" name="origin" value="thread_form">
  302. {{ form_theme.input_select(thread_form['thread_action'],width=3) }}
  303. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  304. </form>
  305. {% endif %}
  306. {% if posts_form%}
  307. <form id="posts_form" class="form-inline pull-right" action="{% url 'private_thread' slug=thread.slug, thread=thread.id, page=pagination['page'] %}" method="POST">
  308. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  309. <input type="hidden" name="origin" value="posts_form">
  310. {{ form_theme.input_select(posts_form['list_action'],width=3) }}
  311. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  312. </form>
  313. {% endif %}
  314. </div>
  315. {% endif %}
  316. <div class="thread-buttons">
  317. {{ pager(false) }}
  318. {% if acl.threads.can_reply(forum, thread) %}
  319. <a href="{% url 'private_thread_reply' thread=thread.pk, slug=thread.slug %}" class="btn btn-inverse pull-right"><i class="icon-pencil"></i> {% trans %}Reply{% endtrans %}</a>
  320. {% endif %}
  321. </div>
  322. {% if acl.threads.can_reply(forum, thread) %}
  323. <div class="thread-quick-reply">
  324. <form action="{% url 'private_thread_reply' thread=thread.pk, slug=thread.slug %}" method="post">
  325. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  326. <input type="hidden" name="quick_reply" value="1">
  327. <img src="{{ user.get_avatar(100) }}" alt="{% trans %}Your Avatar{% endtrans %}" class="user-avatar">
  328. {{ editor.editor(quick_reply.post, _('Post Reply'), extra=editor_extra()) }}
  329. </form>
  330. </div>
  331. {% endif %}
  332. </div>
  333. {% endblock %}
  334. {% block stylesheets %}{{ super() }}
  335. <link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
  336. {% endblock %}
  337. {% block javascripts -%}{{ super() }}
  338. <script src="{{ STATIC_URL }}cranefly/highlight/highlight.pack.js"></script>
  339. <script type="text/javascript">
  340. hljs.tabReplace = ' ';
  341. hljs.initHighlightingOnLoad();
  342. EnhancePostsMD();
  343. $(function () {
  344. $('#thread_form').submit(function() {
  345. if ($('#id_thread_action').val() == 'hard') {
  346. var decision = confirm("{% trans %}Are you sure you want to delete this thread? This action is not reversible!{% endtrans %}");
  347. return decision;
  348. }
  349. return true;
  350. });
  351. $('#posts_form').submit(function() {
  352. if ($('.post-checkbox[]:checked').length == 0) {
  353. alert("{% trans %}You have to select at least one post.{% endtrans %}");
  354. return false;
  355. }
  356. if ($('#id_list_action').val() == 'merge') {
  357. if ($('.post-checkbox[]:checked').length < 2) {
  358. alert("{% trans %}You have to select at least two posts you want to merge.{% endtrans %}");
  359. return false;
  360. }
  361. var decision = confirm("{% trans %}Are you sure you want to merge selected posts? This action is not reversible!{% endtrans %}");
  362. return decision;
  363. }
  364. if ($('#id_list_action').val() == 'hard') {
  365. var decision = confirm("{% trans %}Are you sure you want to delete selected posts? This action is not reversible!{% endtrans %}");
  366. return decision;
  367. }
  368. return true;
  369. });
  370. $('.prompt-delete-thread').submit(function() {
  371. var decision = confirm("{% trans %}Are you sure you want to delete this thread?{% endtrans %}");
  372. return decision;
  373. });
  374. $('.prompt-delete-post').submit(function() {
  375. var decision = confirm("{% trans %}Are you sure you want to delete this post?{% endtrans %}");
  376. return decision;
  377. });
  378. });
  379. </script>
  380. {% if acl.threads.can_reply(forum, thread) %}
  381. {{ editor.js() }}
  382. {% endif %}
  383. {%- endblock %}
  384. {% macro user_label(user) -%}
  385. <{% 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 %}>
  386. {%- endmacro %}
  387. {% macro pager(extra=true) %}
  388. <div class="pagination pull-left">
  389. <ul>
  390. {% if pagination['total'] > 0 %}
  391. <li class="count">{{ macros.pager_label(pagination) }}</li>
  392. {%- if pagination['prev'] > 1 %}<li><a href="{% url 'private_thread' 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 -%}
  393. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{% url 'private_thread' slug=thread.slug, thread=thread.id, page=pagination['prev'] %}{% else %}{% url 'private_thread' slug=thread.slug, thread=thread.id %}{% endif %}" class="tooltip-top" title="{% trans %}Older Posts{% endtrans %}"><i class="icon-chevron-left"></i></a></li>{% endif -%}
  394. {%- if pagination['next'] > 0 %}<li><a href="{% url 'private_thread' 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 -%}
  395. {%- if pagination['next'] > 0 and pagination['next'] < pagination['total'] %}<li><a href="{% url 'private_thread' 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 -%}
  396. {% endif %}
  397. {% if extra %}
  398. {% if not is_read %}<li><a href="{% url 'private_thread_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 %}
  399. {% endif %}
  400. </ul>
  401. </div>
  402. {% endmacro %}
  403. {% macro checkpoint_user(checkpoint) -%}
  404. {%- if checkpoint.user_id -%}
  405. {{ ('<a href="' ~ 'user'|url(user=checkpoint.user_id, username=checkpoint.user_slug) ~ '">')|safe ~ (checkpoint.user_name) ~ ("</a>")|safe }}
  406. {%- else -%}
  407. <strong>{{ checkpoint.user_name }}</strong>
  408. {%- endif -%}
  409. {%- endmacro %}
  410. {% macro edit_user(post) -%}
  411. {%- if post.edit_user_id -%}
  412. {{ ('<a href="' ~ 'user'|url(user=post.edit_user_id, username=post.edit_user_slug) ~ '">')|safe ~ (post.edit_user_name) ~ ("</a>")|safe }}
  413. {%- else -%}
  414. <strong>{{ post.edit_user_name }}</strong>
  415. {%- endif -%}
  416. {%- endmacro %}
  417. {% macro editor_extra() %}
  418. <button id="editor-preview" name="preview" type="submit" class="btn pull-right">{% trans %}Full Editor{% endtrans %}</button>
  419. {% endmacro %}