thread.html 33 KB

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