thread.html 30 KB

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