thread.html 31 KB

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