thread.html 32 KB

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