thread.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  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. {{ macros.parents_list(parents) }}
  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. {% if thread.closed %}<li><i class="icon-lock"></i> {% trans %}Locked{% endtrans %}</li>{% endif %}
  28. </ul>
  29. </div>
  30. </div>
  31. <div class="container container-primary">
  32. {% if message %}
  33. <div class="messages-list">
  34. {{ macros.draw_message(message) }}
  35. </div>
  36. {% endif %}
  37. {% if thread.has_poll %}
  38. <div class="thread-poll">
  39. <h2>{{ thread.poll.question }}</h2>
  40. {% for choice in thread.poll.option_set.all() %}
  41. <div style="background: #{{ colorhex(loop.index0) }}">{{ choice.name }}</div>
  42. {% endfor %}
  43. {% if poll_form %}
  44. <form action="" method="post">
  45. {{ form_theme.field(poll_form.options) }}
  46. </form>
  47. {% else %}
  48. <ul>
  49. {% for choice in thread.poll.option_set.all() %}
  50. <li><div style="background: #{{ colorhex(loop.index0) }}">{{ choice.name }}</div></li>
  51. {% endfor %}
  52. </ul>
  53. {% endif %}
  54. <div id="thread-poll-graph"></div>
  55. </div>
  56. {% endif %}
  57. <div class="thread-buttons">
  58. {{ pager() }}
  59. {% if user.is_authenticated() %}
  60. {% if acl.threads.can_reply(forum, thread) %}
  61. <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>
  62. {% endif %}
  63. {% if watcher %}
  64. <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-icon btn-success tooltip-top" title="{% trans %}Remove thread from watched list{% endtrans %}"><i class="icon-bookmark"></i></button></form>
  65. {% if watcher.email %}
  66. <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-icon 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>
  67. {% else %}
  68. <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 btn-icon tooltip-top" title="{% trans %}E-mail me if anyone replies{% endtrans %}"><i class="icon-envelope"></i></button></form>
  69. {% endif %}
  70. {% else %}
  71. <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 btn-icon tooltip-top" title="{% trans %}Add thread to watched list{% endtrans %}"><i class="icon-bookmark"></i></button></form>
  72. <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 btn-icon tooltip-top" title="{% trans %}Add thread to watched list and e-mail me if anyone replies{% endtrans %}"><i class="icon-envelope"></i></button></form>
  73. {% endif %}
  74. {% if ignored_posts %}
  75. <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>
  76. {% endif %}
  77. {% endif %}
  78. </div>
  79. <div class="thread-body">
  80. {% for post in posts %}
  81. <div id="post-{{ post.pk }}" class="post-wrapper">
  82. {% if post.message %}
  83. <div class="messages-list">
  84. {{ macros.draw_message(post.message) }}
  85. </div>
  86. {% endif %}
  87. {% if post.deleted and not acl.threads.can_see_deleted_posts(forum) %}
  88. <div class="post-body post-muted">
  89. {% if post.user_id %}
  90. <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>
  91. {% else %}
  92. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar">
  93. {% endif %}
  94. <div class="post-content">
  95. <div class="post-header">
  96. <div class="post-header-compact">
  97. {% if post.user_id %}
  98. <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 %}
  99. {% else %}
  100. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  101. {% endif %}
  102. <span class="separator">&ndash;</span>
  103. <a href="{{ url('thread_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-date">{{ post.date|reltimesince }}</a>
  104. {% if post.edits %}
  105. <span class="separator">&ndash;</span>
  106. {% if acl.threads.can_see_changelog(user, forum, post) %}
  107. <a href="{{ url('thread_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>
  108. {% else %}
  109. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  110. {% endif %}
  111. {% endif %}
  112. </div>
  113. <a href="{{ url('thread_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>
  114. {% if not post.is_read %}
  115. <div class="post-extra">
  116. <span class="label label-warning">
  117. {% trans %}New{% endtrans %}
  118. </span>
  119. </div>
  120. {% endif %}
  121. </div>
  122. <div class="post-message">
  123. {% trans user=edit_user(post), date=post.delete_date|reltimesince|low %}{{ user }} has deleted this reply {{ date }}{% endtrans %}
  124. </div>
  125. </dv>
  126. </div>
  127. {% elif post.ignored %}
  128. <div class="post-body post-muted">
  129. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar">
  130. <div class="post-arrow"></div>
  131. <div class="post-content">
  132. <div class="post-header">
  133. <div class="post-header-compact">
  134. <a href="{{ url('thread_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-date">{{ post.date|reltimesince }}</a>
  135. </div>
  136. <a href="{{ url('thread_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>
  137. {% if not post.is_read %}
  138. <div class="post-extra">
  139. <span class="label label-warning">
  140. {% trans %}New{% endtrans %}
  141. </span>
  142. </div>
  143. {% endif %}
  144. </div>
  145. <div class="post-message">
  146. {% trans %}This reply was posted by user that is on your ignored list.{% endtrans %}
  147. </div>
  148. </dv>
  149. </div>
  150. {% else %}
  151. <div class="post-body">
  152. {% if post.user_id %}
  153. <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>
  154. {% else %}
  155. <img src="{{ macros.avatar_guest(100) }}" alt="" class="user-avatar">
  156. {% endif %}
  157. <div class="post-arrow"></div>
  158. <div class="post-content">
  159. <div class="post-header">
  160. {% if post.user_id %}
  161. <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 %}
  162. {% else %}
  163. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  164. {% endif %}
  165. <span class="separator">&ndash;</span>
  166. <a href="{{ url('thread_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-date">{{ post.date|reltimesince }}</a>
  167. {% if post.edits %}
  168. <span class="separator">&ndash;</span>
  169. {% if acl.threads.can_see_changelog(user, forum, post) %}
  170. <a href="{{ url('thread_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>
  171. {% else %}
  172. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  173. {% endif %}
  174. {% endif %}
  175. {% if user.is_authenticated() and posts_form %}
  176. <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>
  177. {% endif %}
  178. <a href="{{ url('thread_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>
  179. <div class="post-extra">
  180. {% if post.protected and acl.threads.can_protect(forum) %}
  181. <span class="label label-info">
  182. {% trans %}Protected{% endtrans %}
  183. </span>
  184. {% endif %}
  185. {% if post.deleted %}
  186. <span class="label label-inverse">
  187. {% trans %}Deleted{% endtrans %}
  188. </span>
  189. {% endif %}
  190. {% if post.moderated %}
  191. <span class="label label-purple">
  192. {% trans %}Unreviewed{% endtrans %}
  193. </span>
  194. {% endif %}
  195. {% if acl.threads.can_mod_posts(forum) and post.reported %}
  196. <span class="label label-important">
  197. {% trans %}Reported{% endtrans %}
  198. </span>
  199. {% endif %}
  200. {% if not post.is_read %}
  201. <span class="label label-warning">
  202. {% trans %}New{% endtrans %}
  203. </span>
  204. {% endif %}
  205. </div>
  206. </div>
  207. <div class="post-message">
  208. <div class="markdown js-extra">
  209. <article>
  210. {{ post.post_preparsed|markdown_final|safe }}
  211. </article>
  212. </div>
  213. {% if post.user.signature %}
  214. <div class="post-signature">
  215. <div class="markdown">
  216. {{ post.user.signature_preparsed|markdown_final|safe }}
  217. </div>
  218. </div>
  219. {% endif %}
  220. </div>
  221. <div class="post-footer">{% filter trim %}
  222. {% if acl.threads.can_see_post_score(forum) %}
  223. <div{% if user.is_authenticated() and user.pk != post.user_id %} class="post-rating-actions"{% endif %}>
  224. <div class="post-rating">
  225. {% if acl.threads.can_see_post_score(forum) == 1 %}
  226. <span class="post-score post-score-total{% if (post.upvotes - post.downvotes) > 0 %} post-score-good{% elif (post.upvotes - post.downvotes) < 0 %} post-score-bad{% endif %}">{{ post.upvotes - post.downvotes }}</span>
  227. {% elif acl.threads.can_see_post_score(forum) == 2%}
  228. <span class="post-score post-score-upvotes{% if post.upvotes %} post-score-good{% endif %}">{{ post.upvotes }}</span>
  229. {% endif %}
  230. {% if user.is_authenticated() and user.pk != post.user_id and acl.threads.can_upvote_posts(forum) %}
  231. <form action="{{ url('post_upvote', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline form-upvote" method="post">
  232. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  233. <button type="submit" class="btn btn-link post-like"{% if post.karma_vote and post.karma_vote.score > 0 %} disabled="disabled"{% endif %}>{% trans %}Like{% endtrans %}</button>
  234. </form>
  235. {% else %}
  236. <span class="post-{% if post.upvotes %}like{% else %}neutral{% endif %}">{% trans %}Likes{% endtrans %}</span>
  237. {% endif %}
  238. {% if acl.threads.can_see_post_score(forum) == 2 %}
  239. </div>
  240. <div class="post-rating">
  241. <span class="post-score post-score-downvotes{% if post.downvotes %} post-score-bad{% endif %}">{{ post.downvotes }}</span>
  242. {% endif %}
  243. {% if user.is_authenticated() and user.pk != post.user_id and acl.threads.can_downvote_posts(forum) %}
  244. <form action="{{ url('post_downvote', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline form-downvote" method="post">
  245. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  246. <button type="submit" class="btn btn-link post-hate"{% if post.karma_vote and post.karma_vote.score < 0 %} disabled="disabled"{% endif %}>{% trans %}Dislike{% endtrans %}</button>
  247. </form>
  248. {% elif acl.threads.can_see_post_score(forum) == 2 %}
  249. <span class="post-{% if post.downvotes %}hate{% else %}neutral{% endif %}">{% trans %}Dislikes{% endtrans %}</span>
  250. {% endif %}
  251. </div>
  252. {% if acl.threads.can_see_post_votes(forum) %}
  253. <div class="post-rating">
  254. <a href="{{ url('post_votes', thread=thread.pk, slug=thread.slug, post=post.pk) }}">{% trans %}Show Votes{% endtrans %}</a>
  255. </div>
  256. {% endif %}
  257. </div>
  258. {% endif %}
  259. {% if user.is_authenticated() %}
  260. <div class="post-actions">
  261. {% if acl.users.can_see_users_trails() -%}
  262. <a href="{{ url('post_info', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-trail">{% trans %}Info{% endtrans %}</a>
  263. {% endif %}
  264. {% if post.reported and acl.reports.can_handle() and acl.threads.can_mod_posts(forum) %}
  265. <a href="{{ url('post_report_show', thread=thread.pk, slug=thread.slug, post=post.pk) }}">{% trans %}Show report{% endtrans %}</a>
  266. {% endif %}
  267. {% if acl.reports.can_report() %}
  268. {% if post.reported_by(user) %}
  269. <a href="{{ url('post_report', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="tooltip-top" title="{% trans %}You have already reported this post.{% endtrans %}" disabled="disabled">{% trans %}Reported{% endtrans %}</a>
  270. {% else %}
  271. <form action="{{ url('post_report', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline form-report" method="post" autocomplete="off">
  272. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  273. <button type="submit" class="btn btn-link btn-report tooltip-top" title="{% trans %}Bring this post to moderator attention.{% endtrans %}">{% trans %}Report{% endtrans %}</button>
  274. </form>
  275. {% endif %}
  276. {% endif %}
  277. {% if acl.threads.can_edit_thread(user, forum, thread, post) and thread.start_post_id == post.pk %}
  278. <a href="{{ url('thread_edit', thread=thread.pk, slug=thread.slug) }}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  279. {% elif acl.threads.can_edit_reply(user, forum, thread, post) %}
  280. <a href="{{ url('post_edit', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  281. {%- endif %}
  282. {% 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 %}
  283. </div>
  284. {% if post.pk == thread.start_post_id %}
  285. <div class="post-actions">
  286. {% if acl.threads.can_delete_thread(user, forum, thread, post) %}
  287. {% if post.deleted %}
  288. <form action="{{ url('thread_show', thread=thread.pk, slug=thread.slug) }}" class="form-inline" method="post">
  289. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  290. <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>
  291. </form>
  292. {% else %}
  293. <form action="{{ url('thread_hide', thread=thread.pk, slug=thread.slug) }}" class="form-inline" method="post">
  294. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  295. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Hide this thread from other users{% endtrans %}">{% trans %}Hide{% endtrans %}</button>
  296. </form>
  297. {% endif %}
  298. {% endif %}
  299. {% if acl.threads.can_delete_thread(user, forum, thread, post) == 2 %}
  300. <form action="{{ url('thread_delete', thread=thread.pk, slug=thread.slug) }}" class="form-inline prompt-delete-thread" method="post">
  301. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  302. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this thread for good{% endtrans %}">{% trans %}Delete{% endtrans %}</button>
  303. </form>
  304. {% endif %}
  305. </div>
  306. {% elif post.pk != thread.start_post_id and acl.threads.can_delete_post(user, forum, thread, post) %}
  307. <div class="post-actions">
  308. {% if acl.threads.can_delete_post(user, forum, thread, post) %}
  309. {% if post.deleted %}
  310. <form action="{{ url('post_show', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline" method="post">
  311. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  312. <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>
  313. </form>
  314. {% else %}
  315. <form action="{{ url('post_hide', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline" method="post">
  316. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  317. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Hide this reply from other users{% endtrans %}">{% trans %}Hide{% endtrans %}</button>
  318. </form>
  319. {% endif %}
  320. {% endif %}
  321. {% if acl.threads.can_delete_post(user, forum, thread, post) == 2 -%}
  322. <form action="{{ url('post_delete', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline prompt-delete-post" method="post">
  323. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  324. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this reply for good{% endtrans %}">{% trans %}Delete{% endtrans %}</button>
  325. </form>
  326. {% endif %}
  327. </div>
  328. {% endif %}
  329. {% endif %}
  330. {% endfilter %}</div>
  331. </div>
  332. </div>
  333. {% endif %}
  334. </div>
  335. {% if post.checkpoints_visible %}
  336. <div class="post-checkpoints">
  337. {% for checkpoint in post.checkpoints_visible %}
  338. <div class="post-checkpoint{% if checkpoint.deleted %} checkpoint-deleted{% endif %}">
  339. <hr>
  340. <span>
  341. {%- if checkpoint.action == 'limit' -%}
  342. <i class="icon-lock"></i> {% trans %}This thread has reached its post limit and has been closed.{% endtrans %}
  343. {%- elif checkpoint.action == 'accepted' -%}
  344. <i class="icon-ok"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} accepted this thread {{ date }}{% endtrans %}
  345. {%- elif checkpoint.action == 'closed' -%}
  346. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} closed this thread {{ date }}{% endtrans %}
  347. {%- elif checkpoint.action == 'opened' -%}
  348. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} opened this thread {{ date }}{% endtrans %}
  349. {%- elif checkpoint.action == 'deleted' -%}
  350. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} deleted this thread {{ date }}{% endtrans %}
  351. {%- elif checkpoint.action == 'undeleted' -%}
  352. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} restored this thread {{ date }}{% endtrans %}
  353. {%- elif checkpoint.action == 'moved' and acl.forums.can_see(checkpoint.old_forum_id) -%}
  354. <i class="icon-arrow-right"></i> {% trans user=checkpoint_user(checkpoint), forum=checkpoint_forum(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} moved this thread from {{ forum }} {{ date }}{% endtrans %}
  355. {%- endif -%}
  356. {% if user.is_authenticated() %}
  357. {% if acl.threads.can_delete_checkpoint(forum) %}
  358. {% if checkpoint.deleted %}
  359. <form action="{{ url('post_checkpoint_show', slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk) }}" method="post" class="form-inline">
  360. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  361. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  362. <button type="submit" class="btn btn-link btn-show">{% trans %}Restore{% endtrans %}</button>
  363. </form>
  364. {% else %}
  365. <form action="{{ url('post_checkpoint_hide', slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk) }}" method="post" class="form-inline">
  366. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  367. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  368. <button type="submit" class="btn btn-link btn-hide">{% trans %}Hide{% endtrans %}</button>
  369. </form>
  370. {% endif %}
  371. {% endif %}
  372. {% if acl.threads.can_delete_checkpoint(forum) == 2 %}
  373. <form action="{{ url('post_checkpoint_delete', slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk) }}" method="post" class="form-inline prompt-delete-checkpoint">
  374. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  375. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  376. <button type="submit" class="btn btn-link btn-delete">{% trans %}Delete{% endtrans %}</button>
  377. </form>
  378. {% endif %}
  379. {% endif %}
  380. </span>
  381. </div>
  382. {% endfor %}
  383. </div>
  384. {% endif %}
  385. {% endfor %}
  386. </div>
  387. {% if user.is_authenticated() and (thread_form or posts_form) %}
  388. <div class="thread-moderation">
  389. {% if thread_form %}
  390. <form id="thread_form" class="form-inline pull-left" action="{{ request_path }}" method="POST">
  391. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  392. <input type="hidden" name="origin" value="thread_form">
  393. {{ form_theme.field(thread_form.thread_action, attrs={'class': 'span3'}) }}
  394. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  395. </form>
  396. {% endif %}
  397. {% if posts_form %}
  398. <form id="posts_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  399. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  400. <input type="hidden" name="origin" value="posts_form">
  401. {{ form_theme.field(posts_form.list_action, attrs={'class': 'span3'}) }}
  402. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  403. </form>
  404. {% endif %}
  405. </div>
  406. {% endif %}
  407. <div class="thread-buttons">
  408. {{ pager(false) }}
  409. {% if user.is_authenticated() and acl.threads.can_reply(forum, thread) %}
  410. <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>
  411. {% elif not user.is_authenticated() and not user.is_crawler() %}
  412. <p class="lead thread-signin-message"><a href="{{ url('sign_in') }}">{% trans %}Sign in or register to reply.{% endtrans %}</a></p>
  413. {% endif %}
  414. </div>
  415. {% if user.is_authenticated() and acl.threads.can_reply(forum, thread) %}
  416. <div class="thread-quick-reply">
  417. <form action="{{ url('thread_reply', thread=thread.pk, slug=thread.slug) }}" method="post">
  418. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  419. <input type="hidden" name="quick_reply" value="1">
  420. <img src="{{ user.get_avatar(100) }}" alt="{% trans %}Your Avatar{% endtrans %}" class="user-avatar">
  421. {{ editor.editor(quick_reply.post, _('Post Reply'), zen=True, extra=editor_extra()) }}
  422. </form>
  423. </div>
  424. {% endif %}
  425. </div>
  426. {% endblock %}
  427. {% block stylesheets %}{{ super() }}
  428. <link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
  429. {% endblock %}
  430. {% block javascripts -%}
  431. {{ editor.zen() }}
  432. {{ super() }}
  433. <script src="{{ STATIC_URL }}cranefly/highlight/highlight.pack.js"></script>
  434. <script type="text/javascript">
  435. var l_post_reported = "{{ _('Reported!') }}";
  436. hljs.tabReplace = ' ';
  437. hljs.initHighlightingOnLoad();
  438. EnhancePostsMD();
  439. {%- if user.is_authenticated() %}
  440. $(function () {
  441. $('#thread_form').submit(function() {
  442. if ($('#id_thread_action').val() == 'hard') {
  443. var decision = confirm("{% trans %}Are you sure you want to delete this thread? This action is not reversible!{% endtrans %}");
  444. return decision;
  445. }
  446. return true;
  447. });
  448. $('#posts_form').submit(function() {
  449. if ($('.post-checkbox[]:checked').length == 0) {
  450. alert("{% trans %}You have to select at least one post.{% endtrans %}");
  451. return false;
  452. }
  453. if ($('#id_list_action').val() == 'merge') {
  454. if ($('.post-checkbox[]:checked').length < 2) {
  455. alert("{% trans %}You have to select at least two posts you want to merge.{% endtrans %}");
  456. return false;
  457. }
  458. var decision = confirm("{% trans %}Are you sure you want to merge selected posts? This action is not reversible!{% endtrans %}");
  459. return decision;
  460. }
  461. if ($('#id_list_action').val() == 'hard') {
  462. var decision = confirm("{% trans %}Are you sure you want to delete selected posts? This action is not reversible!{% endtrans %}");
  463. return decision;
  464. }
  465. return true;
  466. });
  467. $('.prompt-delete-thread').submit(function() {
  468. var decision = confirm("{% trans %}Are you sure you want to delete this thread?{% endtrans %}");
  469. return decision;
  470. });
  471. $('.prompt-delete-post').submit(function() {
  472. var decision = confirm("{% trans %}Are you sure you want to delete this post?{% endtrans %}");
  473. return decision;
  474. });
  475. $('.prompt-delete-checkpoint').submit(function() {
  476. var decision = confirm("{% trans %}Are you sure you want to delete this checkpoint?{% endtrans %}");
  477. return decision;
  478. });
  479. });
  480. {% endif %}
  481. </script>
  482. {% if user.is_authenticated() and acl.threads.can_reply(forum, thread) %}
  483. {{ editor.js() }}
  484. {% endif %}
  485. {% if thread.has_poll %}
  486. <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  487. <script type="text/javascript">
  488. google.load("visualization", "1", {packages:["corechart"]});
  489. google.setOnLoadCallback(drawChart);
  490. function drawChart() {
  491. var data = google.visualization.arrayToDataTable([
  492. ["{{ thread.poll.question }}", "{% trans %}Votes{% endtrans %}"]
  493. {% for option in thread.poll.option_set.all() %}
  494. , ["{{ option.name }}", {{ option.votes}}]
  495. {% endfor %}
  496. ]);
  497. var options = {
  498. };
  499. var chart = new google.visualization.PieChart(document.getElementById('thread-poll-graph'));
  500. chart.draw(data, options);
  501. }
  502. </script>
  503. {% endif %}
  504. {%- endblock %}
  505. {% macro user_label(user) -%}
  506. <{% 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 %}>
  507. {%- endmacro %}
  508. {% macro pager(extra=true) %}
  509. <div class="pagination pull-left">
  510. <ul>
  511. {% if pagination['total'] > 0 %}
  512. <li class="count">{{ macros.pager_label(pagination) }}</li>
  513. {%- 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 -%}
  514. {%- 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 -%}
  515. {%- 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 -%}
  516. {%- 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 -%}
  517. {% endif %}
  518. {% if extra and user.is_authenticated() %}
  519. {% 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 %}
  520. {% 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 %}
  521. {% if thread.replies_reported > 0 and acl.threads.can_mod_posts(forum) %}<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 %}
  522. {% endif %}
  523. </ul>
  524. </div>
  525. {% endmacro %}
  526. {% macro checkpoint_user(checkpoint) -%}
  527. {%- if checkpoint.user_id -%}
  528. <a href="{{ url('user', user=checkpoint.user_id, username=checkpoint.user_slug) }}">{{ checkpoint.user_name }}</a>
  529. {%- else -%}
  530. <strong>{{ checkpoint.user_name }}</strong>
  531. {%- endif -%}
  532. {%- endmacro %}
  533. {% macro checkpoint_forum(checkpoint) -%}
  534. {%- if checkpoint.old_forum_id -%}
  535. <a href="{{ url('forum', forum=checkpoint.old_forum_id, slug=checkpoint.old_forum_slug) }}">{{ checkpoint.old_forum_name }}</a>
  536. {%- else -%}
  537. <strong>{{ checkpoint.old_forum_name }}</strong>
  538. {%- endif -%}
  539. {%- endmacro %}
  540. {% macro edit_user(post) -%}
  541. {%- if post.edit_user_id -%}
  542. <a href="{{ url('user', user=post.edit_user_id, username=post.edit_user_slug) }}">{{ post.edit_user_name }}</a>
  543. {%- else -%}
  544. <strong>{{ post.edit_user_name }}</strong>
  545. {%- endif -%}
  546. {%- endmacro %}
  547. {% macro editor_extra() %}
  548. <button id="editor-preview" name="preview" type="submit" class="btn pull-right">{% trans %}Full Editor{% endtrans %}</button>
  549. {% endmacro %}