posting.html 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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=_(get_title()), parent=thread.name) }}{% endblock %}
  6. {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
  7. <li><a href="{{ url('reports') }}">{% trans %}Reported Posts{% endtrans %}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  8. <li><a href="{{ url('report', thread=thread.pk, slug=thread.slug) }}">{{ thread.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
  9. <li class="active">{{ get_title() }}
  10. {%- endblock %}
  11. {% block container %}
  12. <div class="page-header header-primary">
  13. <div class="container">
  14. {{ messages_list(messages) }}
  15. <ul class="breadcrumb">
  16. {{ self.breadcrumb() }}</li>
  17. </ul>
  18. <h1>{{ get_title() }} <small>{{ thread.name }}</small></h1>
  19. <ul class="unstyled header-stats">
  20. <li><i class="icon-tag"></i> {% if thread.weight == 2 -%}
  21. {% trans %}Open{% endtrans %}
  22. {%- elif thread.weight == 1 -%}
  23. Resolved
  24. {%- else -%}
  25. Bogus
  26. {%- endif %}</li>
  27. {{ get_info() }}
  28. </ul>
  29. </div>
  30. </div>
  31. <div class="container container-primary">
  32. <div class="row">
  33. <div class="span8 offset2">
  34. <div class="posting">
  35. <div class="form-container">
  36. <div class="form-header">
  37. <h1>{{ get_title() }}</h1>
  38. </div>
  39. {% if message %}
  40. <div class="messages-list">
  41. {{ macros.draw_message(message) }}
  42. </div>
  43. {% endif %}
  44. {% if preview %}
  45. <div class="form-preview">
  46. <div class="markdown js-extra">
  47. <article>
  48. {{ preview|markdown_final|safe }}
  49. </article>
  50. </div>
  51. </div>
  52. {% endif %}
  53. <form action="{{ get_action() }}" method="post">
  54. <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
  55. {% if 'thread_name' in form.fields %}
  56. {{ form_theme.row(form.thread_name, attrs={'class': 'span8'}) }}
  57. <hr>
  58. <h4>{% trans %}Message Body{% endtrans %}</h4>
  59. {% endif %}
  60. {{ editor.editor(form.post, get_button(), rows=8, extra=get_extra()) }}
  61. {% if intersect(form.fields, ('edit_reason', 'thread_weight')) %}
  62. <hr>
  63. {% if 'edit_reason' in form.fields %}
  64. {{ form_theme.row(form.edit_reason, attrs={'class': 'span8'}) }}
  65. {% endif %}
  66. {% if 'thread_weight' in form.fields %}
  67. <div class="control-group">
  68. <label class="control-label">{% trans %}Set Report Status{% endtrans %}:</label>
  69. <div class="controls">
  70. {{ form_theme.field(form.thread_weight) }}
  71. </div>
  72. </div>
  73. {% endif %}
  74. <div class="form-actions">
  75. <button type="submit" class="btn btn-primary">{{ get_button() }}</button>
  76. <button id="editor-preview" name="preview" type="submit" class="btn">{% trans %}Preview{% endtrans %}</button>
  77. </div>
  78. {% endif %}
  79. </form>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. {% endblock %}
  86. {% block stylesheets %}{{ super() }}
  87. <link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
  88. {% endblock %}
  89. {% block javascripts %}{{ super() }}
  90. <script src="{{ STATIC_URL }}cranefly/highlight/highlight.pack.js"></script>
  91. <script type="text/javascript">
  92. hljs.tabReplace = ' ';
  93. hljs.initHighlightingOnLoad();
  94. EnhancePostsMD();
  95. </script>
  96. {{ editor.js() }}
  97. {% endblock %}
  98. {% macro get_action() -%}
  99. {% if action == 'new_thread' -%}
  100. {{ url('report_start', forum=forum.pk, slug=forum.slug) }}
  101. {%- elif action == 'edit_thread' -%}
  102. {{ url('report_edit', thread=thread.pk, slug=thread.slug) }}
  103. {%- elif action in 'new_reply' -%}
  104. {%- if quote -%}
  105. {{ url('report_reply', thread=thread.pk, slug=thread.slug, quote=quote.pk) }}
  106. {%- else -%}
  107. {{ url('report_reply', thread=thread.pk, slug=thread.slug) }}
  108. {%- endif -%}
  109. {%- elif action == 'edit_reply' -%}
  110. {{ url('post_edit', thread=thread.pk, slug=thread.slug, post=post.pk) }}
  111. {%- endif %}
  112. {%- endmacro %}
  113. {% macro get_title() -%}
  114. {%- if action == 'edit_thread' -%}
  115. {% trans %}Edit Report{% endtrans %}
  116. {%- elif action == 'new_reply' -%}
  117. {% trans %}Post New Comment{% endtrans %}
  118. {%- elif action == 'edit_reply' -%}
  119. {% trans %}Edit Comment{% endtrans %}
  120. {%- endif %}
  121. {%- endmacro %}
  122. {% macro get_info() -%}
  123. {% if action == 'edit_reply' -%}
  124. <li><i class="icon-time"></i> <a href="{{ url('report_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}">{{ post.date|reltimesince }}</a></li>
  125. <li><i class="icon-user"></i> {% if post.user %}<a href="{{ url('user', user=post.user.pk, username=post.user.username_slug) }}">{{ post.user.username }}</a>{% else %}{{ post.user_name }}{% endif %}</li>
  126. <li><i class="icon-pencil"></i> {% if post.edits > 0 -%}
  127. {% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}
  128. {%- else -%}
  129. {% trans %}First edit{% endtrans %}
  130. {%- endif %}</li>
  131. {%- else -%}
  132. {% if action == 'edit_thread' %}
  133. <li><i class="icon-time"></i> <a href="{{ url('report_find', thread=thread.pk, slug=thread.slug, post=thread.start_post_id) }}">{{ thread.start|reltimesince }}</a></li>
  134. {% else %}
  135. <li><i class="icon-time"></i> <a href="{{ url('report_new', thread=thread.pk, slug=thread.slug) }}">{{ thread.last|reltimesince }}</a></li>
  136. {% endif %}
  137. <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>
  138. <li><i class="icon-comment"></i> {% if thread.replies > 0 -%}
  139. {% trans count=thread.replies, replies=thread.replies|intcomma %}One comment{% pluralize %}{{ replies }} comments{% endtrans %}
  140. {%- else -%}
  141. {% trans %}No comments{% endtrans %}
  142. {%- endif %}</li>
  143. {%- endif %}
  144. {% if thread.closed %}<li><i class="icon-lock"></i> {% trans %}Locked{% endtrans %}</li>{% endif %}
  145. {%- endmacro %}
  146. {% macro get_button() -%}
  147. {% if action == 'new_reply' -%}
  148. {% trans %}Post Comment{% endtrans %}
  149. {%- else -%}
  150. {% trans %}Save Changes{% endtrans %}
  151. {%- endif %}
  152. {%- endmacro %}
  153. {% macro get_extra() %}
  154. <button id="editor-preview" name="preview" type="submit" class="btn pull-right">{% trans %}Preview{% endtrans %}</button>
  155. {% endmacro %}