|
@@ -0,0 +1,124 @@
|
|
|
+{% extends "cranefly/layout.html" %}
|
|
|
+{% import "_forms.html" as form_theme with context %}
|
|
|
+{% import "cranefly/editor.html" as editor with context %}
|
|
|
+{% import "cranefly/macros.html" as macros with context %}
|
|
|
+
|
|
|
+{% block title %}{% if thread -%}
|
|
|
+{{ macros.page_title(title=_(get_title()), parent=thread.name) }}
|
|
|
+{%- else -%}
|
|
|
+{{ macros.page_title(title=_(get_title()), parent=_('Global Announcements')) }}
|
|
|
+{%- endif %}{% endblock %}
|
|
|
+
|
|
|
+{% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
|
|
|
+<li><a href="{% url 'announcements' %}">{% trans %}Global Announcements{% endtrans %}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
|
|
|
+{% if thread %}<li><a href="{% url 'announcement' thread=thread.pk, slug=thread.slug %}">{{ thread.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>{% endif %}
|
|
|
+<li class="active">{{ get_title() }}
|
|
|
+{%- endblock %}
|
|
|
+
|
|
|
+{% block container %}
|
|
|
+<div class="page-header header-primary">
|
|
|
+ <div class="container">
|
|
|
+ {{ messages_list(messages) }}
|
|
|
+ <ul class="breadcrumb">
|
|
|
+ {{ self.breadcrumb() }}</li>
|
|
|
+ </ul>
|
|
|
+ <h1>{{ get_title() }} <small>{% if thread %}{{ thread.name }}{% else %}{% trans %}Global Announcements{% endtrans %}{% endif %}</small></h1>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+<div class="container container-primary">
|
|
|
+ <div class="row">
|
|
|
+ <div class="span8 offset2">
|
|
|
+ <div class="posting">
|
|
|
+ <div class="form-container">
|
|
|
+
|
|
|
+ <div class="form-header">
|
|
|
+ <h1>{{ get_title() }}</h1>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ {% if message %}
|
|
|
+ <div class="messages-list">
|
|
|
+ {{ macros.draw_message(message) }}
|
|
|
+ </div>
|
|
|
+ {% endif %}
|
|
|
+
|
|
|
+ {% if preview %}
|
|
|
+ <div class="form-preview">
|
|
|
+ <div class="markdown js-extra">
|
|
|
+ {{ preview|markdown_final|safe }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {% endif %}
|
|
|
+
|
|
|
+ <form action="{{ get_action() }}" method="post">
|
|
|
+ <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
|
|
|
+ {% if 'thread_name' in form.fields %}
|
|
|
+ {{ form_theme.row_widget(form.fields.thread_name, width=8) }}
|
|
|
+ <hr>
|
|
|
+ <h4>Message Body</h4>
|
|
|
+ {% endif %}
|
|
|
+ {{ editor.editor(form.fields.post, get_button(), rows=8, extra=get_extra()) }}
|
|
|
+ {% if intersect(form.fields, ('edit_reason', 'thread_weight', 'close_thread')) %}
|
|
|
+ <hr>
|
|
|
+ {% if 'edit_reason' in form.fields %}
|
|
|
+ {{ form_theme.row_widget(form.fields.edit_reason, width=8) }}
|
|
|
+ {% endif %}
|
|
|
+
|
|
|
+ <div class="form-actions">
|
|
|
+ <button type="submit" class="btn btn-primary">{{ get_button() }}</button>
|
|
|
+ <button id="editor-preview" name="preview" type="submit" class="btn">{% trans %}Preview{% endtrans %}</button>
|
|
|
+ </div>
|
|
|
+ {% endif %}
|
|
|
+ </form>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+{% endblock %}
|
|
|
+
|
|
|
+{% block stylesheets %}{{ super() }}
|
|
|
+<link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
|
|
|
+{% endblock %}
|
|
|
+
|
|
|
+{% block javascripts %}{{ super() }}
|
|
|
+ <script src="{{ STATIC_URL }}cranefly/highlight/highlight.pack.js"></script>
|
|
|
+ <script type="text/javascript">
|
|
|
+ hljs.tabReplace = ' ';
|
|
|
+ hljs.initHighlightingOnLoad();
|
|
|
+ EnhancePostsMD();
|
|
|
+ </script>
|
|
|
+ {{ editor.js() }}
|
|
|
+{% endblock %}
|
|
|
+
|
|
|
+
|
|
|
+{% macro get_action() -%}
|
|
|
+{% if action == 'new_thread' -%}
|
|
|
+{% url 'announcement_start' %}
|
|
|
+{%- elif action == 'edit_thread' -%}
|
|
|
+{% url 'announcement_edit' thread=thread.pk, slug=thread.slug %}
|
|
|
+{%- endif %}
|
|
|
+{%- endmacro %}
|
|
|
+
|
|
|
+
|
|
|
+{% macro get_title() -%}
|
|
|
+{% if action == 'new_thread' -%}
|
|
|
+{% trans %}Post New Announcement{% endtrans %}
|
|
|
+{%- elif action == 'edit_thread' -%}
|
|
|
+{% trans %}Edit Announcement{% endtrans %}
|
|
|
+{%- endif %}
|
|
|
+{%- endmacro %}
|
|
|
+
|
|
|
+
|
|
|
+{% macro get_button() -%}
|
|
|
+{% if action == 'new_thread' -%}
|
|
|
+{% trans %}Post Announcement{% endtrans %}
|
|
|
+{%- else -%}
|
|
|
+{% trans %}Save Changes{% endtrans %}
|
|
|
+{%- endif %}
|
|
|
+{%- endmacro %}
|
|
|
+
|
|
|
+
|
|
|
+{% macro get_extra() %}
|
|
|
+ <button id="editor-preview" name="preview" type="submit" class="btn pull-right">{% trans %}Preview{% endtrans %}</button>
|
|
|
+{% endmacro %}
|