thread.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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=_("Private Threads"),page=pagination['page']) }}{% endblock %}
  6. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  7. <li><a href="{{ url('private_threads') }}">{% trans %}Private Threads{% endtrans %}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  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. <li class="stats-form">
  29. <form class="leave-form" action="{{ url('private_thread_remove_user', thread=thread.pk, slug=thread.slug) }}" method="post">
  30. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  31. <input type="hidden" name="user" value="{{ user.pk }}">
  32. <button type="submit" class="btn"><i class="icon-remove"></i> {% trans %}Leave Thread{% endtrans %}</button>
  33. </form>
  34. </li>
  35. </ul>
  36. </div>
  37. </div>
  38. <div class="container container-primary">
  39. {% if message %}
  40. <div class="messages-list">
  41. {{ macros.draw_message(message) }}
  42. </div>
  43. {% endif %}
  44. <div class="row">
  45. <div class="span9">
  46. <div class="thread-buttons">
  47. {{ pager() }}
  48. {% if acl.threads.can_reply(forum, thread) and (acl.private_threads.is_mod() or participants|length > 1) %}
  49. <a href="{{ url('private_thread_reply', thread=thread.pk, slug=thread.slug) }}" class="btn btn-inverse pull-right"><i class="icon-pencil"></i> {% trans %}Reply{% endtrans %}</a>
  50. {% endif %}
  51. {% if watcher %}
  52. <form action="{{ url('private_thread_unwatch', thread=thread.pk, slug=thread.slug) }}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn btn-icon btn-success tooltip-top" title="{% trans %}Remove thread from watched list{% endtrans %}"><i class="icon-bookmark"></i></button></form>
  53. {% if watcher.email %}
  54. <form action="{{ url('private_thread_unwatch_email', thread=thread.pk, slug=thread.slug) }}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn btn-icon btn-success tooltip-top" title="{% trans %}Don't e-mail me anymore if anyone replies to this thread{% endtrans %}"><i class="icon-envelope"></i></button></form>
  55. {% else %}
  56. <form action="{{ url('private_thread_watch_email', thread=thread.pk, slug=thread.slug) }}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn btn-icon tooltip-top" title="{% trans %}E-mail me if anyone replies{% endtrans %}"><i class="icon-envelope"></i></button></form>
  57. {% endif %}
  58. {% else %}
  59. <form action="{{ url('private_thread_watch', thread=thread.pk, slug=thread.slug) }}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn btn-icon tooltip-top" title="{% trans %}Add thread to watched list{% endtrans %}"><i class="icon-bookmark"></i></button></form>
  60. <form action="{{ url('private_thread_watch_email', thread=thread.pk, slug=thread.slug) }}" class="form-inline pull-right" method="post"><input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}"><input type="hidden" name="retreat" value="{{ request_path }}"><button type="submit" class="btn btn-icon tooltip-top" title="{% trans %}Add thread to watched list and e-mail me if anyone replies{% endtrans %}"><i class="icon-envelope"></i></button></form>
  61. {% endif %}
  62. {% if ignored_posts %}
  63. <form action="{{ url('private_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>
  64. {% endif %}
  65. </div>
  66. <div class="thread-body">
  67. {% for post in posts %}
  68. <div id="post-{{ post.pk }}" class="post-wrapper">
  69. {% if post.message %}
  70. <div class="messages-list">
  71. {{ macros.draw_message(post.message) }}
  72. </div>
  73. {% endif %}
  74. {% if post.deleted and not acl.threads.can_see_deleted_posts(forum) %}
  75. <div class="post-body post-muted">
  76. {% if post.user_id %}
  77. <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>
  78. {% else %}
  79. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar">
  80. {% endif %}
  81. <div class="post-content">
  82. <div class="post-header">
  83. <div class="post-header-compact">
  84. {% if post.user_id %}
  85. <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 %}
  86. {% else %}
  87. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  88. {% endif %}
  89. <span class="separator">&ndash;</span>
  90. <a href="{{ url('private_thread_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-date">{{ post.date|reltimesince }}</a>
  91. {% if post.edits %}
  92. <span class="separator">&ndash;</span>
  93. {% if acl.threads.can_see_changelog(user, forum, post) %}
  94. <a href="{{ url('private_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>
  95. {% else %}
  96. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  97. {% endif %}
  98. {% endif %}
  99. </div>
  100. <a href="{{ url('private_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>
  101. {% if not post.is_read %}
  102. <div class="post-extra">
  103. <span class="label label-warning">
  104. {% trans %}New{% endtrans %}
  105. </span>
  106. </div>
  107. {% endif %}
  108. </div>
  109. <div class="post-message">
  110. {% trans user=edit_user(post), date=post.delete_date|reltimesince|low %}{{ user }} has deleted this reply {{ date }}{% endtrans %}
  111. </div>
  112. </dv>
  113. </div>
  114. {% elif post.ignored %}
  115. <div class="post-body post-muted">
  116. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar">
  117. <div class="post-arrow"></div>
  118. <div class="post-content">
  119. <div class="post-header">
  120. <div class="post-header-compact">
  121. <a href="{{ url('private_thread_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-date">{{ post.date|reltimesince }}</a>
  122. </div>
  123. <a href="{{ url('private_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>
  124. {% if not post.is_read %}
  125. <div class="post-extra">
  126. <span class="label label-warning">
  127. {% trans %}New{% endtrans %}
  128. </span>
  129. </div>
  130. {% endif %}
  131. </div>
  132. <div class="post-message">
  133. {% trans %}This reply was posted by user that is on your ignored list.{% endtrans %}
  134. </div>
  135. </dv>
  136. </div>
  137. {% else %}
  138. <div class="post-body">
  139. {% if post.user_id %}
  140. <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>
  141. {% else %}
  142. <img src="{{ macros.avatar_guest(100) }}" alt="" class="user-avatar">
  143. {% endif %}
  144. <div class="post-arrow"></div>
  145. <div class="post-content">
  146. <div class="post-header">
  147. {% if post.user_id %}
  148. <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 %}
  149. {% else %}
  150. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  151. {% endif %}
  152. <span class="separator">&ndash;</span>
  153. <a href="{% if pagination['page'] > 1 -%}
  154. {{ url('private_thread', thread=thread.pk, slug=thread.slug, page=pagination['page']) }}
  155. {%- else -%}
  156. {{ url('private_thread', thread=thread.pk, slug=thread.slug) }}
  157. {%- endif %}#post-{{ post.pk }}" class="post-date">{{ post.date|reltimesince }}</a>
  158. {% if post.edits %}
  159. <span class="separator">&ndash;</span>
  160. {% if acl.threads.can_see_changelog(user, forum, post) %}
  161. <a href="{{ url('private_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>
  162. {% else %}
  163. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  164. {% endif %}
  165. {% endif %}
  166. {% if posts_form %}
  167. <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>
  168. {% endif %}
  169. <a href="{% if pagination['page'] > 1 -%}
  170. {{ url('private_thread', thread=thread.pk, slug=thread.slug, page=pagination['page']) }}
  171. {%- else -%}
  172. {{ url('private_thread', thread=thread.pk, slug=thread.slug) }}
  173. {%- endif %}#post-{{ post.pk }}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  174. <div class="post-extra">
  175. {% if post.protected and acl.threads.can_protect(forum) %}
  176. <span class="label label-info">
  177. {% trans %}Protected{% endtrans %}
  178. </span>
  179. {% endif %}
  180. {% if post.deleted %}
  181. <span class="label label-inverse">
  182. {% trans %}Deleted{% endtrans %}
  183. </span>
  184. {% endif %}
  185. {% if post.moderated %}
  186. <span class="label label-purple">
  187. {% trans %}Unreviewed{% endtrans %}
  188. </span>
  189. {% endif %}
  190. {% if acl.threads.can_mod_posts(forum) and post.reported %}
  191. <span class="label label-important">
  192. {% trans %}Reported{% endtrans %}
  193. </span>
  194. {% endif %}
  195. {% if not post.is_read %}
  196. <span class="label label-warning">
  197. {% trans %}New{% endtrans %}
  198. </span>
  199. {% endif %}
  200. </div>
  201. </div>
  202. <div class="post-message">
  203. <div class="markdown js-extra">
  204. <article>
  205. {{ post.post_preparsed|markdown_final|safe }}
  206. </article>
  207. </div>
  208. {% if post.has_attachments and acl.threads.can_download_attachments(user, forum, post) %}
  209. <div class="post-attachments">
  210. <h3>{% trans %}Attached files{% endtrans %}</h3>
  211. {% for row in post.attachments|batch(2) %}
  212. {% if not loop.first %}
  213. <hr>
  214. {% endif %}
  215. <div class="row-fluid">
  216. {% for attachment in row %}
  217. <div class="span6">
  218. <div class="post-attachment">
  219. <div class="attachment-image">
  220. <a href="{{ url('attachments_server', attachment=attachment.hash_id) }}">
  221. {% if attachment.is_image %}
  222. <img src="{{ url('attachments_thumbs_server', attachment=attachment.hash_id) }}" alt="">
  223. {% else %}
  224. <i class="icon-file"></i>
  225. {% endif %}
  226. </a>
  227. </div>
  228. <div class="attachment-body">
  229. <h4><a href="{{ url('attachments_server', attachment=attachment.hash_id) }}">{{ attachment.name }}</a></h4>
  230. <div class="attachment-details">
  231. {% if attachment.user_id %}
  232. <a href="{{ url('user', user=attachment.user_id, username=attachment.user_name_slug) }}">{{ attachment.user_name }}</a>,
  233. {% else %}
  234. {{ attachment.user_name }},
  235. {% endif %}
  236. {% if acl.users.can_see_users_trails() %}
  237. <abbr title="{{ attachment.agent }}">{{ attachment.ip }}</abbr>,
  238. {% endif %}
  239. {{ attachment.date|date }},
  240. {{ _(attachment.filetype.name) }}, {{ attachment.size|filesize }}
  241. </div>
  242. </div>
  243. </div>
  244. </div>
  245. {% endfor %}
  246. </div>
  247. {% endfor %}
  248. </div>
  249. {% endif %}
  250. {% if post.user.signature %}
  251. <div class="post-signature">
  252. <div class="markdown">
  253. {{ post.user.signature_preparsed|markdown_final|safe }}
  254. </div>
  255. </div>
  256. {% endif %}
  257. </div>
  258. <div class="post-footer">{% filter trim %}
  259. <div class="post-actions">
  260. {% if acl.users.can_see_users_trails() -%}
  261. <a href="{{ url('private_post_info', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-trail">{% trans %}Info{% endtrans %}</a>
  262. {% endif %}
  263. {% if post.reported and acl.reports.can_handle() and acl.threads.can_mod_posts(forum) %}
  264. <a href="{{ url('private_post_report_show', thread=thread.pk, slug=thread.slug, post=post.pk) }}">{% trans %}Show report{% endtrans %}</a>
  265. {% endif %}
  266. {% if acl.reports.can_report() %}
  267. {% if post.reported_by(user) %}
  268. <a href="{{ url('private_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>
  269. {% else %}
  270. <form action="{{ url('private_post_report', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline form-report" method="post" autocomplete="off">
  271. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  272. <button type="submit" class="btn btn-link btn-report tooltip-top" title="{% trans %}Bring this post to moderator attention.{% endtrans %}">{% trans %}Report{% endtrans %}</button>
  273. </form>
  274. {% endif %}
  275. {% endif %}
  276. {% if acl.threads.can_edit_thread(user, forum, thread, post) and thread.start_post_id == post.pk %}
  277. <a href="{{ url('private_thread_edit', thread=thread.pk, slug=thread.slug) }}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  278. {% elif acl.threads.can_edit_reply(user, forum, thread, post) %}
  279. <a href="{{ url('private_post_edit', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  280. {%- endif %}
  281. {% if acl.threads.can_reply(forum, thread) and (acl.private_threads.is_mod() or participants|length > 1) %}
  282. <a href="{{ url('private_thread_reply', thread=thread.pk, slug=thread.slug, quote=post.pk) }}" class="post-reply">{% trans %}Reply{% endtrans %}</a>
  283. {% endif %}
  284. </div>
  285. {% if post.pk == thread.start_post_id %}
  286. <div class="post-actions">
  287. {% if acl.threads.can_delete_thread(user, forum, thread, post) %}
  288. {% if post.deleted %}
  289. <form action="{{ url('private_thread_show', thread=thread.pk, slug=thread.slug) }}" class="form-inline" method="post">
  290. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  291. <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>
  292. </form>
  293. {% else %}
  294. <form action="{{ url('private_thread_hide', thread=thread.pk, slug=thread.slug) }}" class="form-inline" method="post">
  295. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  296. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Hide this thread from other users{% endtrans %}">{% trans %}Hide{% endtrans %}</button>
  297. </form>
  298. {% endif %}
  299. {% endif %}
  300. {% if acl.threads.can_delete_thread(user, forum, thread, post) == 2 %}
  301. <form action="{{ url('private_thread_delete', thread=thread.pk, slug=thread.slug) }}" class="form-inline prompt-delete-thread" method="post">
  302. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  303. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this thread for good{% endtrans %}">{% trans %}Delete{% endtrans %}</button>
  304. </form>
  305. {% endif %}
  306. </div>
  307. {% elif post.pk != thread.start_post_id and acl.threads.can_delete_post(user, forum, thread, post) %}
  308. <div class="post-actions">
  309. {% if acl.threads.can_delete_post(user, forum, thread, post) %}
  310. {% if post.deleted %}
  311. <form action="{{ url('private_post_show', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline" method="post">
  312. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  313. <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>
  314. </form>
  315. {% else %}
  316. <form action="{{ url('private_post_hide', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline" method="post">
  317. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  318. <button type="submit" class="btn btn-link btn-hide tooltip-top" title="{% trans %}Hide this reply from other users{% endtrans %}">{% trans %}Hide{% endtrans %}</button>
  319. </form>
  320. {% endif %}
  321. {% endif %}
  322. {% if acl.threads.can_delete_post(user, forum, thread, post) == 2 -%}
  323. <form action="{{ url('private_post_delete', thread=thread.pk, slug=thread.slug, post=post.pk) }}" class="form-inline prompt-delete-post" method="post">
  324. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  325. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this reply for good{% endtrans %}">{% trans %}Delete{% endtrans %}</button>
  326. </form>
  327. {% endif %}
  328. </div>
  329. {% endif %}
  330. {% endfilter %}</div>
  331. </div>
  332. </div>
  333. {% endif %}
  334. </div>
  335. {% if post.checkpoints_visible %}
  336. <div class="post-checkpoints">
  337. {% for checkpoint in post.checkpoints_visible %}
  338. <div class="post-checkpoint">
  339. <hr>
  340. <span>
  341. {%- if checkpoint.action == 'limit' -%}
  342. <i class="icon-lock"></i> {% trans %}This thread has reached its post limit and has been closed.{% endtrans %}
  343. {%- elif checkpoint.action == 'accepted' -%}
  344. <i class="icon-ok"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} accepted this thread {{ date }}{% endtrans %}
  345. {%- elif checkpoint.action == 'closed' -%}
  346. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} closed this thread {{ date }}{% endtrans %}
  347. {%- elif checkpoint.action == 'opened' -%}
  348. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} opened this thread {{ date }}{% endtrans %}
  349. {%- elif checkpoint.action == 'deleted' -%}
  350. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} deleted this thread {{ date }}{% endtrans %}
  351. {%- elif checkpoint.action == 'undeleted' -%}
  352. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} restored this thread {{ date }}{% endtrans %}
  353. {%- elif checkpoint.action == 'invited' -%}
  354. <i class="icon-plus-sign"></i> {% trans user=checkpoint_user(checkpoint), invited=checkpoint_target(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} added {{ invited }} to thread {{ date }}{% endtrans %}
  355. {%- elif checkpoint.action == 'removed' -%}
  356. <i class="icon-remove-sign"></i> {% trans user=checkpoint_user(checkpoint), removed=checkpoint_target(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} removed {{ removed }} from thread {{ date }}{% endtrans %}
  357. {%- elif checkpoint.action == 'left' -%}
  358. <i class="icon-remove-sign"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} left thread {{ date }}{% endtrans %}
  359. {%- endif -%}
  360. {% if user.is_authenticated() %}
  361. {% if acl.threads.can_delete_checkpoint(forum) %}
  362. {% if checkpoint.deleted %}
  363. <form action="{{ url('private_post_checkpoint_show', slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk) }}" method="post" class="form-inline">
  364. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  365. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  366. <button type="submit" class="btn btn-link btn-show">{% trans %}Restore{% endtrans %}</button>
  367. </form>
  368. {% else %}
  369. <form action="{{ url('private_post_checkpoint_hide', slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk) }}" method="post" class="form-inline">
  370. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  371. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  372. <button type="submit" class="btn btn-link btn-hide">{% trans %}Hide{% endtrans %}</button>
  373. </form>
  374. {% endif %}
  375. {% endif %}
  376. {% if acl.threads.can_delete_checkpoint(forum) == 2 %}
  377. <form action="{{ url('private_post_checkpoint_delete', slug=thread.slug, thread=thread.pk, checkpoint=checkpoint.pk) }}" method="post" class="form-inline prompt-delete-checkpoint">
  378. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  379. <input type="hidden" name="retreat" value="{{ request_path }}#post-{{ post.pk }}">
  380. <button type="submit" class="btn btn-link btn-delete">{% trans %}Delete{% endtrans %}</button>
  381. </form>
  382. {% endif %}
  383. {% endif %}
  384. </span>
  385. </div>
  386. {% endfor %}
  387. </div>
  388. {% endif %}
  389. {% endfor %}
  390. </div>
  391. {% if thread_form or posts_form %}
  392. <div class="thread-moderation">
  393. {% if thread_form%}
  394. <form id="thread_form" class="form-inline pull-left" action="{{ request_path }}" method="POST">
  395. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  396. <input type="hidden" name="origin" value="thread_form">
  397. {{ form_theme.field(thread_form.thread_action, attrs={'class': 'span3'}) }}
  398. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  399. </form>
  400. {% endif %}
  401. {% if posts_form %}
  402. <form id="posts_form" class="form-inline pull-right" action="{{ request_path }}" method="POST">
  403. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  404. <input type="hidden" name="origin" value="posts_form">
  405. {{ form_theme.field(posts_form.list_action, attrs={'class': 'span3'}) }}
  406. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  407. </form>
  408. {% endif %}
  409. </div>
  410. {% endif %}
  411. <div class="thread-buttons">
  412. {{ pager(false) }}
  413. {% if acl.threads.can_reply(forum, thread) and (acl.private_threads.is_mod() or participants|length > 1) %}
  414. <a href="{{ url('private_thread_reply', thread=thread.pk, slug=thread.slug) }}" class="btn btn-inverse pull-right"><i class="icon-pencil"></i> {% trans %}Reply{% endtrans %}</a>
  415. {% else %}
  416. <p class="lead thread-signin-message">{% trans %}This thread has too few participants.{% endtrans %}</p>
  417. {% endif %}
  418. </div>
  419. {% if acl.threads.can_reply(forum, thread) and (acl.private_threads.is_mod() or participants|length > 1) %}
  420. <div class="thread-quick-reply">
  421. <form action="{{ url('private_thread_reply', thread=thread.pk, slug=thread.slug) }}" method="post">
  422. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  423. <input type="hidden" name="quick_reply" value="1">
  424. <img src="{{ user.get_avatar(100) }}" alt="{% trans %}Your Avatar{% endtrans %}" class="user-avatar">
  425. {{ editor.editor(quick_reply.post, _('Post Reply'), zen=True, extra=editor_extra()) }}
  426. </form>
  427. </div>
  428. {% endif %}
  429. </div>
  430. <div class="span3">
  431. <div class="thread-participants">
  432. <h3>{% trans participants=participants|length -%}
  433. One participant
  434. {%- pluralize -%}
  435. {{ participants }} participants
  436. {%- endtrans %}</h3>
  437. <ul class="unstyled">{% for participant in participants %}
  438. <li>
  439. <img src="{{ participant.get_avatar(24) }}" alt="" class="avatar-small">
  440. <a href="{{ url('user', username=participant.username_slug, user=participant.pk) }}">{{ participant.username }}</a>
  441. {% if user.pk == thread.start_poster_id or acl.private_threads.is_mod() %}
  442. <form class="form-inline {% if user.pk == participant.pk %}leave-form{% else %}kick-form{% endif %} tooltip-left" action="{{ url('private_thread_remove_user', thread=thread.pk, slug=thread.slug) }}" method="post" title="{% if participant.pk == user.pk %}{% trans %}Leave this thread{% endtrans %}{% else %}{% trans %}Remove from this thread{% endtrans %}{% endif %}">
  443. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  444. <input type="hidden" name="retreat" value="{{ request_path }}">
  445. <input type="hidden" name="user" value="{{ participant.pk }}">
  446. <button type="submit" class="btn btn-{% if participant.pk == user.pk %}danger{% else %}inverse{% endif %} btn-small"><i class="icon-remove"></i></button>
  447. </form>
  448. {% endif %}
  449. </li>
  450. {% endfor %}
  451. </ul>
  452. {% if participants|length < 2 %}
  453. <p class="no-participants">{% trans %}This thread has too few participants. Invite other users to open it for new replies.{% endtrans %}</p>
  454. {% endif %}
  455. <h4>{% trans %}Invite User{% endtrans %}</h4>
  456. <div class="invite-participant">
  457. <form class="form-inline" action="{{ url('private_thread_invite_user', thread=thread.pk, slug=thread.slug) }}" method="post">
  458. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  459. <input type="hidden" name="retreat" value="{{ request_path }}">
  460. {{ form_theme.field(invite_form.username, attrs={'class': 'span2', 'placeholder': lang_user_to_invite()}) }}
  461. <button class="btn" type="submit"><i class="icon-plus"></i></button>
  462. </form>
  463. </div>
  464. </div>
  465. </div>
  466. </div>
  467. </div>
  468. {% endblock %}
  469. {% block stylesheets %}{{ super() }}
  470. <link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
  471. {% endblock %}
  472. {% block javascripts -%}
  473. {{ editor.zen() }}
  474. {{ super() }}
  475. <script src="{{ STATIC_URL }}cranefly/highlight/highlight.pack.js"></script>
  476. <script type="text/javascript">
  477. var l_post_reported = "{{ _('Reported!') }}";
  478. hljs.tabReplace = ' ';
  479. hljs.initHighlightingOnLoad();
  480. EnhancePostsMD();
  481. $(function () {
  482. $('.leave-form').submit(function() {
  483. var decision = confirm("{% if participants|length == 1 -%}
  484. {% trans %}Are you sure you want to leave this thread? It will be deleted after you leave!{% endtrans %}
  485. {%- else -%}
  486. {% trans %}Are you sure you want to leave this thread?{% endtrans %}
  487. {%- endif %}");
  488. return decision;
  489. });
  490. $('.kick-form').submit(function() {
  491. var decision = confirm("{% trans %}Are you sure you want to remove this member from this thread?{% endtrans %}");
  492. return decision;
  493. });
  494. $('#thread_form').submit(function() {
  495. if ($('#id_thread_action').val() == 'hard') {
  496. var decision = confirm("{% trans %}Are you sure you want to delete this thread? This action is not reversible!{% endtrans %}");
  497. return decision;
  498. }
  499. return true;
  500. });
  501. $('#posts_form').submit(function() {
  502. if ($('.post-checkbox[]:checked').length == 0) {
  503. alert("{% trans %}You have to select at least one post.{% endtrans %}");
  504. return false;
  505. }
  506. if ($('#id_list_action').val() == 'merge') {
  507. if ($('.post-checkbox[]:checked').length < 2) {
  508. alert("{% trans %}You have to select at least two posts you want to merge.{% endtrans %}");
  509. return false;
  510. }
  511. var decision = confirm("{% trans %}Are you sure you want to merge selected posts? This action is not reversible!{% endtrans %}");
  512. return decision;
  513. }
  514. if ($('#id_list_action').val() == 'hard') {
  515. var decision = confirm("{% trans %}Are you sure you want to delete selected posts? This action is not reversible!{% endtrans %}");
  516. return decision;
  517. }
  518. return true;
  519. });
  520. $('.prompt-delete-thread').submit(function() {
  521. var decision = confirm("{% trans %}Are you sure you want to delete this thread?{% endtrans %}");
  522. return decision;
  523. });
  524. $('.prompt-delete-post').submit(function() {
  525. var decision = confirm("{% trans %}Are you sure you want to delete this post?{% endtrans %}");
  526. return decision;
  527. });
  528. $('.prompt-delete-checkpoint').submit(function() {
  529. var decision = confirm("{% trans %}Are you sure you want to delete this checkpoint?{% endtrans %}");
  530. return decision;
  531. });
  532. });
  533. </script>
  534. {% if acl.threads.can_reply(forum, thread) %}
  535. {{ editor.js() }}
  536. {% endif %}
  537. {%- endblock %}
  538. {% macro user_label(user) -%}
  539. <{% 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 %}>
  540. {%- endmacro %}
  541. {% macro pager(extra=true) %}
  542. <div class="pagination pull-left">
  543. <ul>
  544. {% if pagination['total'] > 0 %}
  545. <li class="count">{{ macros.pager_label(pagination) }}</li>
  546. {%- if pagination['prev'] > 1 %}<li><a href="{{ url('private_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 -%}
  547. {%- if pagination['prev'] > 0 %}<li><a href="{%- if pagination['prev'] > 1 %}{{ url('private_thread', slug=thread.slug, thread=thread.id, page=pagination['prev']) }}{% else %}{{ url('private_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 -%}
  548. {%- if pagination['next'] > 0 %}<li><a href="{{ url('private_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 -%}
  549. {%- if pagination['next'] > 0 and pagination['next'] < pagination['total'] %}<li><a href="{{ url('private_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 -%}
  550. {% endif %}
  551. {% if extra %}
  552. {% if not is_read %}<li><a href="{{ url('private_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 %}
  553. {% endif %}
  554. {% if thread.replies_reported > 0 and acl.threads.can_mod_posts(forum) %}<li><a href="{{ url('private_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 %}
  555. </ul>
  556. </div>
  557. {% endmacro %}
  558. {% macro checkpoint_user(checkpoint) -%}
  559. {%- if checkpoint.user_id -%}
  560. <a href="{{ url('user', user=checkpoint.user_id, username=checkpoint.user_slug) }}">{{ checkpoint.user_name }}</a>
  561. {%- else -%}
  562. <strong>{{ checkpoint.user_name }}</strong>
  563. {%- endif -%}
  564. {%- endmacro %}
  565. {% macro checkpoint_target(checkpoint) -%}
  566. {%- if checkpoint.target_user_id -%}
  567. <a href="{{ url('user', user=checkpoint.target_user_id, username=checkpoint.target_user_slug) }}">{{ checkpoint.target_user_name }}</a>
  568. {%- else -%}
  569. <strong>{{ checkpoint.target_user_name }}</strong>
  570. {%- endif -%}
  571. {%- endmacro %}
  572. {% macro edit_user(post) -%}
  573. {%- if post.edit_user_id -%}
  574. <a href="{{ url('user', user=post.edit_user_id, username=post.edit_user_slug) }}">{{ post.edit_user_name }}</a>
  575. {%- else -%}
  576. <strong>{{ post.edit_user_name }}</strong>
  577. {%- endif -%}
  578. {%- endmacro %}
  579. {% macro editor_extra() %}
  580. <button id="editor-preview" name="preview" type="submit" class="btn pull-right">{% trans %}Full Editor{% endtrans %}</button>
  581. {% endmacro %}
  582. {# Language strings macros #}
  583. {% macro lang_user_to_invite() -%}{% trans %}User to invite...{% endtrans %}{%- endmacro %}