thread.html 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  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> Leave Thread</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 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-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-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 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 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 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"></a>
  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="{% if pagination['page'] > 1 -%}
  91. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  92. {%- else -%}
  93. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  94. {%- endif %}#post-{{ post.pk }}" class="post-date">{{ post.date|reltimesince }}</a>
  95. {% if post.edits %}
  96. <span class="separator">&ndash;</span>
  97. {% if acl.threads.can_see_changelog(user, forum, post) %}
  98. <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>
  99. {% else %}
  100. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  101. {% endif %}
  102. {% endif %}
  103. </div>
  104. <a href="{% if pagination['page'] > 1 -%}
  105. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  106. {%- else -%}
  107. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  108. {%- endif %}#post-{{ post.pk }}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  109. {% if not post.is_read %}
  110. <div class="post-extra">
  111. <span class="label label-warning">
  112. {% trans %}New{% endtrans %}
  113. </span>
  114. </div>
  115. {% endif %}
  116. </div>
  117. <div class="post-message">
  118. {% trans user=edit_user(post), date=post.edit_date|reltimesince|low %}{{ user }} has deleted this reply {{ date }}{% endtrans %}
  119. </div>
  120. </dv>
  121. </div>
  122. {% elif post.ignored %}
  123. <div class="post-body post-muted">
  124. <img src="{{ macros.avatar_guest(60) }}" alt="" class="user-avatar"></a>
  125. <div class="post-arrow"></div>
  126. <div class="post-content">
  127. <div class="post-header">
  128. <div class="post-header-compact">
  129. <a href="{% if pagination['page'] > 1 -%}
  130. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  131. {%- else -%}
  132. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  133. {%- endif %}#post-{{ post.pk }}" class="post-date">{{ post.date|reltimesince }}</a>
  134. </div>
  135. <a href="{% if pagination['page'] > 1 -%}
  136. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  137. {%- else -%}
  138. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  139. {%- endif %}#post-{{ post.pk }}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  140. {% if not post.is_read %}
  141. <div class="post-extra">
  142. <span class="label label-warning">
  143. {% trans %}New{% endtrans %}
  144. </span>
  145. </div>
  146. {% endif %}
  147. </div>
  148. <div class="post-message">
  149. {% trans %}This reply was posted by user that is on your ignored list.{% endtrans %}
  150. </div>
  151. </dv>
  152. </div>
  153. {% else %}
  154. <div class="post-body">
  155. {% if post.user_id %}
  156. <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>
  157. {% else %}
  158. <img src="{{ macros.avatar_guest(100) }}" alt="" class="user-avatar"></a>
  159. {% endif %}
  160. <div class="post-arrow"></div>
  161. <div class="post-content">
  162. <div class="post-header">
  163. {% if post.user_id %}
  164. <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 %}
  165. {% else %}
  166. <span class="post-author">{{ post.user_name }}</span> <span class="label post-author-label post-label-guest">{% trans %}Unregistered{% endtrans %}</span>
  167. {% endif %}
  168. <span class="separator">&ndash;</span>
  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-date">{{ post.date|reltimesince }}</a>
  174. {% if post.edits %}
  175. <span class="separator">&ndash;</span>
  176. {% if acl.threads.can_see_changelog(user, forum, post) %}
  177. <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>
  178. {% else %}
  179. <span class="post-changelog">{% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}</span>
  180. {% endif %}
  181. {% endif %}
  182. {% if posts_form %}
  183. <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>
  184. {% endif %}
  185. <a href="{% if pagination['page'] > 1 -%}
  186. {% url 'private_thread' thread=thread.pk, slug=thread.slug, page=pagination['page'] %}
  187. {%- else -%}
  188. {% url 'private_thread' thread=thread.pk, slug=thread.slug %}
  189. {%- endif %}#post-{{ post.pk }}" class="post-perma tooltip-left" title="{% trans %}Direct link to this post{% endtrans %}">#{{ pagination['start'] + loop.index }}</a>
  190. <div class="post-extra">
  191. {% if post.protected and acl.threads.can_protect(forum) %}
  192. <span class="label label-info">
  193. {% trans %}Protected{% endtrans %}
  194. </span>
  195. {% endif %}
  196. {% if post.deleted %}
  197. <span class="label label-inverse">
  198. {% trans %}Deleted{% endtrans %}
  199. </span>
  200. {% endif %}
  201. {% if post.moderated %}
  202. <span class="label label-purple">
  203. {% trans %}Unreviewed{% endtrans %}
  204. </span>
  205. {% endif %}
  206. {% if post.reported %}
  207. <span class="label label-important">
  208. {% trans %}Reported{% endtrans %}
  209. </span>
  210. {% endif %}
  211. {% if not post.is_read %}
  212. <span class="label label-warning">
  213. {% trans %}New{% endtrans %}
  214. </span>
  215. {% endif %}
  216. </div>
  217. </div>
  218. <div class="post-message">
  219. <div class="markdown js-extra">
  220. {{ post.post_preparsed|markdown_final|safe }}
  221. </div>
  222. {% if post.user.signature %}
  223. <div class="post-signature">
  224. <div class="markdown">
  225. {{ post.user.signature_preparsed|markdown_final|safe }}
  226. </div>
  227. </div>
  228. {% endif %}
  229. </div>
  230. <div class="post-footer">{% filter trim %}
  231. <div class="post-actions">
  232. {% if acl.users.can_see_users_trails() -%}
  233. <a href="{% url 'private_post_info' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-trail">{% trans %}Info{% endtrans %}</a>
  234. {% endif %}
  235. {% if acl.threads.can_edit_thread(user, forum, thread, post) and thread.start_post_id == post.pk %}
  236. <a href="{% url 'private_thread_edit' thread=thread.pk, slug=thread.slug %}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  237. {% elif acl.threads.can_edit_reply(user, forum, thread, post) %}
  238. <a href="{% url 'private_post_edit' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="post-edit">{% trans %}Edit{% endtrans %}</a>
  239. {%- endif %}
  240. {% if acl.threads.can_reply(forum, thread) %}<a href="{% url 'private_thread_reply' thread=thread.pk, slug=thread.slug, quote=post.pk %}" class="post-reply">{% trans %}Reply{% endtrans %}</a>{% endif %}
  241. </div>
  242. {% if post.pk == thread.start_post_id %}
  243. <div class="post-actions">
  244. {% if acl.threads.can_delete_thread(user, forum, thread, post) == 2 %}
  245. <form action="{% url 'private_thread_delete' thread=thread.pk, slug=thread.slug %}" class="form-inline prompt-delete-thread" method="post">
  246. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  247. <span>{% trans %}Delete thread:{% endtrans %}</span>
  248. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this thread for good{% endtrans %}">{% trans %}Hard{% endtrans %}</button>
  249. </form>
  250. {% endif %}
  251. {% if not post.deleted and acl.threads.can_delete_thread(user, forum, thread, post) %}
  252. <form action="{% url 'private_thread_hide' thread=thread.pk, slug=thread.slug %}" class="form-inline prompt-delete-thread" method="post">
  253. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  254. {% if acl.threads.can_delete_thread(user, forum, thread, post) != 2 %}
  255. <span>{% trans %}Delete thread:{% endtrans %}</span>
  256. {% endif %}
  257. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Hide this thread from other users{% endtrans %}">{% trans %}Soft{% endtrans %}</button>
  258. </form>
  259. {% endif %}
  260. </div>
  261. {% elif post.pk != thread.start_post_id and acl.threads.can_delete_post(user, forum, thread, post) %}
  262. <div class="post-actions">
  263. {% if acl.threads.can_delete_post(user, forum, thread, post) == 2 -%}
  264. <form action="{% url 'private_post_delete' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="form-inline prompt-delete-post" method="post">
  265. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  266. <span>{% trans %}Delete reply:{% endtrans %}</span>
  267. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Delete this reply for good{% endtrans %}">{% trans %}Hard{% endtrans %}</button>
  268. </form>
  269. {% endif %}
  270. {% if not post.deleted and acl.threads.can_delete_post(user, forum, thread, post) %}
  271. <form action="{% url 'private_post_hide' thread=thread.pk, slug=thread.slug, post=post.pk %}" class="form-inline prompt-delete-post" method="post">
  272. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  273. {% if acl.threads.can_delete_post(user, forum, thread, post) != 2 %}
  274. <span>{% trans %}Delete reply:{% endtrans %}</span>
  275. {% endif %}
  276. <button type="submit" class="btn btn-link tooltip-top" title="{% trans %}Hide this reply from other users{% endtrans %}">{% trans %}Soft{% endtrans %}</button>
  277. </form>
  278. {% endif %}
  279. </div>
  280. {% endif %}
  281. {% endfilter %}</div>
  282. </div>
  283. </div>
  284. {% endif %}
  285. </div>
  286. {% if post.checkpoint_set.all() %}
  287. <div class="post-checkpoints">
  288. {% for checkpoint in post.checkpoint_set.all() %}
  289. <div class="post-checkpoint">
  290. <hr>
  291. <span>
  292. {%- if checkpoint.action == 'limit' -%}
  293. <i class="icon-lock"></i> {% trans %}This thread has reached its post limit and has been closed.{% endtrans %}
  294. {%- elif checkpoint.action == 'accepted' -%}
  295. <i class="icon-ok"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} accepted this thread {{ date }}{% endtrans %}
  296. {%- elif checkpoint.action == 'closed' -%}
  297. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} closed this thread {{ date }}{% endtrans %}
  298. {%- elif checkpoint.action == 'opened' -%}
  299. <i class="icon-lock"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} opened this thread {{ date }}{% endtrans %}
  300. {%- elif checkpoint.action == 'deleted' -%}
  301. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} deleted this thread {{ date }}{% endtrans %}
  302. {%- elif checkpoint.action == 'undeleted' -%}
  303. <i class="icon-trash"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} restored this thread {{ date }}{% endtrans %}
  304. {%- elif checkpoint.action == 'invited' -%}
  305. <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 %}
  306. {%- elif checkpoint.action == 'removed' -%}
  307. <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 %}
  308. {%- elif checkpoint.action == 'left' -%}
  309. <i class="icon-remove-sign"></i> {% trans user=checkpoint_user(checkpoint), date=checkpoint.date|reltimesince|low %}{{ user }} left thread {{ date }}{% endtrans %}
  310. {%- endif -%}
  311. {% if user.is_authenticated() %}
  312. {% if acl.threads.can_delete_checkpoint(forum) %}
  313. {% if checkpoint.deleted %}
  314. <form action="{% url 'private_post_checkpoint_show' slug=thread.slug, thread=thread.pk, post=post.pk, checkpoint=checkpoint.pk %}" method="post" class="form-inline">
  315. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  316. <button type="submit" class="btn btn-link btn-show">{% trans %}Show{% endtrans %}</button>
  317. </form>
  318. {% else %}
  319. <form action="{% url 'private_post_checkpoint_hide' slug=thread.slug, thread=thread.pk, post=post.pk, checkpoint=checkpoint.pk %}" method="post" class="form-inline">
  320. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  321. <button type="submit" class="btn btn-link btn-hide">{% trans %}Hide{% endtrans %}</button>
  322. </form>
  323. {% endif %}
  324. {% endif %}
  325. {% if acl.threads.can_delete_checkpoint(forum) == 2 %}
  326. <form action="{% url 'private_post_checkpoint_delete' slug=thread.slug, thread=thread.pk, post=post.pk, checkpoint=checkpoint.pk %}" method="post" class="form-inline prompt-delete-checkpoint">
  327. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  328. <button type="submit" class="btn btn-link btn-delete">{% trans %}Delete{% endtrans %}</button>
  329. </form>
  330. {% endif %}
  331. {% endif %}
  332. </span>
  333. </div>
  334. {% endfor %}
  335. </div>
  336. {% endif %}
  337. {% endfor %}
  338. </div>
  339. {% if thread_form or posts_form %}
  340. <div class="thread-moderation">
  341. {% if thread_form%}
  342. <form id="thread_form" class="form-inline pull-left" action="{% url 'private_thread' slug=thread.slug, thread=thread.id, page=pagination['page'] %}" method="POST">
  343. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  344. <input type="hidden" name="origin" value="thread_form">
  345. {{ form_theme.input_select(thread_form['thread_action'],width=3) }}
  346. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  347. </form>
  348. {% endif %}
  349. {% if posts_form%}
  350. <form id="posts_form" class="form-inline pull-right" action="{% url 'private_thread' slug=thread.slug, thread=thread.id, page=pagination['page'] %}" method="POST">
  351. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  352. <input type="hidden" name="origin" value="posts_form">
  353. {{ form_theme.input_select(posts_form['list_action'],width=3) }}
  354. <button type="submit" class="btn btn-danger">{% trans %}Go{% endtrans %}</button>
  355. </form>
  356. {% endif %}
  357. </div>
  358. {% endif %}
  359. <div class="thread-buttons">
  360. {{ pager(false) }}
  361. {% if acl.threads.can_reply(forum, thread) and participants|length > 1 %}
  362. <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>
  363. {% else %}
  364. <p class="lead thread-signin-message">{% trans %}This thread has no participants.{% endtrans %}</p>
  365. {% endif %}
  366. </div>
  367. {% if acl.threads.can_reply(forum, thread) and participants|length > 1 %}
  368. <div class="thread-quick-reply">
  369. <form action="{% url 'private_thread_reply' thread=thread.pk, slug=thread.slug %}" method="post">
  370. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  371. <input type="hidden" name="quick_reply" value="1">
  372. <img src="{{ user.get_avatar(100) }}" alt="{% trans %}Your Avatar{% endtrans %}" class="user-avatar">
  373. {{ editor.editor(quick_reply.post, _('Post Reply'), extra=editor_extra()) }}
  374. </form>
  375. </div>
  376. {% endif %}
  377. </div>
  378. <div class="span3">
  379. <div class="thread-participants">
  380. <h3>{% trans participants=participants|length -%}
  381. One participant
  382. {%- pluralize -%}
  383. {{ participants }} participants
  384. {%- endtrans %}</h3>
  385. <ul class="unstyled">{% for participant in participants %}
  386. <li>
  387. <img src="{{ participant.get_avatar(24) }}" alt="" class="avatar-small">
  388. <a href="{% url 'user' username=participant.username_slug, user=participant.pk %}">{{ participant.username }}</a>
  389. {% if user.pk == thread.start_poster_id or acl.private_threads.is_mod() %}
  390. <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 %}">
  391. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  392. <input type="hidden" name="retreat" value="{{ request_path }}">
  393. <input type="hidden" name="user" value="{{ participant.pk }}">
  394. <button type="submit" class="btn btn-{% if participant.pk == user.pk %}danger{% else %}inverse{% endif %} btn-small"><i class="icon-remove"></i></button>
  395. </form>
  396. {% endif %}
  397. </li>
  398. {% endfor %}
  399. </ul>
  400. {% if participants|length < 2%}
  401. <p class="no-participants">{% trans %}This thread has too few participants. Invite other users to open it for new replies.{% endtrans %}</p>
  402. {% endif %}
  403. <h4>{% trans %}Invite User{% endtrans %}</h4>
  404. <div class="invite-participant">
  405. <form class="form-inline" action="{% url 'private_thread_invite_user' thread=thread.pk, slug=thread.slug %}" method="post">
  406. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  407. <input type="hidden" name="retreat" value="{{ request_path }}">
  408. {{ form_theme.input_text(invite_form.fields.username, width="2", attrs={'placeholder':_("User to invite...")}) }}
  409. <button class="btn" type="submit"><i class="icon-plus"></i></button>
  410. </form>
  411. </div>
  412. </div>
  413. </div>
  414. </div>
  415. </div>
  416. {% endblock %}
  417. {% block stylesheets %}{{ super() }}
  418. <link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
  419. {% endblock %}
  420. {% block javascripts -%}{{ super() }}
  421. <script src="{{ STATIC_URL }}cranefly/highlight/highlight.pack.js"></script>
  422. <script type="text/javascript">
  423. hljs.tabReplace = ' ';
  424. hljs.initHighlightingOnLoad();
  425. EnhancePostsMD();
  426. $(function () {
  427. $('.leave-form').submit(function() {
  428. var decision = confirm("{% if participants|length == 1 -%}
  429. {% trans %}Are you sure you want to leave this thread? It will be deleted after you leave!{% endtrans %}
  430. {%- else -%}
  431. {% trans %}Are you sure you want to leave this thread?{% endtrans %}
  432. {%- endif %}");
  433. return decision;
  434. });
  435. $('.kick-form').submit(function() {
  436. var decision = confirm("{% trans %}Are you sure you want to remove this member from this thread?{% endtrans %}");
  437. return decision;
  438. });
  439. $('#thread_form').submit(function() {
  440. if ($('#id_thread_action').val() == 'hard') {
  441. var decision = confirm("{% trans %}Are you sure you want to delete this thread? This action is not reversible!{% endtrans %}");
  442. return decision;
  443. }
  444. return true;
  445. });
  446. $('#posts_form').submit(function() {
  447. if ($('.post-checkbox[]:checked').length == 0) {
  448. alert("{% trans %}You have to select at least one post.{% endtrans %}");
  449. return false;
  450. }
  451. if ($('#id_list_action').val() == 'merge') {
  452. if ($('.post-checkbox[]:checked').length < 2) {
  453. alert("{% trans %}You have to select at least two posts you want to merge.{% endtrans %}");
  454. return false;
  455. }
  456. var decision = confirm("{% trans %}Are you sure you want to merge selected posts? This action is not reversible!{% endtrans %}");
  457. return decision;
  458. }
  459. if ($('#id_list_action').val() == 'hard') {
  460. var decision = confirm("{% trans %}Are you sure you want to delete selected posts? This action is not reversible!{% endtrans %}");
  461. return decision;
  462. }
  463. return true;
  464. });
  465. $('.prompt-delete-thread').submit(function() {
  466. var decision = confirm("{% trans %}Are you sure you want to delete this thread?{% endtrans %}");
  467. return decision;
  468. });
  469. $('.prompt-delete-post').submit(function() {
  470. var decision = confirm("{% trans %}Are you sure you want to delete this post?{% endtrans %}");
  471. return decision;
  472. });
  473. $('.prompt-delete-checkpoint').submit(function() {
  474. var decision = confirm("{% trans %}Are you sure you want to delete this checkpoint?{% endtrans %}");
  475. return decision;
  476. });
  477. });
  478. </script>
  479. {% if acl.threads.can_reply(forum, thread) %}
  480. {{ editor.js() }}
  481. {% endif %}
  482. {%- endblock %}
  483. {% macro user_label(user) -%}
  484. <{% 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 %}>
  485. {%- endmacro %}
  486. {% macro pager(extra=true) %}
  487. <div class="pagination pull-left">
  488. <ul>
  489. {% if pagination['total'] > 0 %}
  490. <li class="count">{{ macros.pager_label(pagination) }}</li>
  491. {%- 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 -%}
  492. {%- 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 -%}
  493. {%- 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 -%}
  494. {%- 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 -%}
  495. {% endif %}
  496. {% if extra %}
  497. {% 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 %}
  498. {% endif %}
  499. </ul>
  500. </div>
  501. {% endmacro %}
  502. {% macro checkpoint_user(checkpoint) -%}
  503. {%- if checkpoint.user_id -%}
  504. <a href="{{ 'user'|url(user=checkpoint.user_id, username=checkpoint.user_slug) }}">{{ checkpoint.user_name }}</a>
  505. {%- else -%}
  506. <strong>{{ checkpoint.user_name }}</strong>
  507. {%- endif -%}
  508. {%- endmacro %}
  509. {% macro checkpoint_target(checkpoint) -%}
  510. {%- if checkpoint.target_user_id -%}
  511. <a href="{{ 'user'|url(user=checkpoint.target_user_id, username=checkpoint.target_user_slug) }}">{{ checkpoint.target_user_name }}</a>
  512. {%- else -%}
  513. <strong>{{ checkpoint.target_user_name }}</strong>
  514. {%- endif -%}
  515. {%- endmacro %}
  516. {% macro edit_user(post) -%}
  517. {%- if post.edit_user_id -%}
  518. <a href="{{ 'user'|url(user=post.edit_user_id, username=post.edit_user_slug) }}">{{ post.edit_user_name }}</a>
  519. {%- else -%}
  520. <strong>{{ post.edit_user_name }}</strong>
  521. {%- endif -%}
  522. {%- endmacro %}
  523. {% macro editor_extra() %}
  524. <button id="editor-preview" name="preview" type="submit" class="btn pull-right">{% trans %}Full Editor{% endtrans %}</button>
  525. {% endmacro %}