thread.html 30 KB

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