thread.html 31 KB

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