123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- {% extends "sora/layout.html" %}
- {% load i18n %}
- {% load url from future %}
- {% import "_forms.html" as form_theme with context %}
- {% import "sora/editor.html" as editor with context %}
- {% import "sora/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=forum.name) }}
- {%- endif %}{% endblock %}
- {% block breadcrumb %}{{ super() }} <span class="divider">/</span></li>
- {% for parent in parents %}
- <li><a href="{{ parent.type|url(forum=forum.pk, slug=forum.slug) }}">{{ parent.name }}</a> <span class="divider">/</span></li>
- {% endfor %}
- {% if thread %}<li><a href="{% url 'thread' thread=thread.pk, slug=thread.slug %}">{{ thread.name }}</a> <span class="divider">/</span></li>{% endif %}
- <li class="active">{{ get_title() }}
- {%- endblock %}
- {% block content %}
- <div class="page-header">
- <ul class="breadcrumb">
- {{ self.breadcrumb() }}</li>
- </ul>
- <h1>{{ get_title() }} <small>{% if thread %}{{ thread.name }}{% else %}{{ forum.name }}{% endif %}</small></h1>
- {% if thread %}
- <ul class="unstyled thread-info">
- {% if thread.moderated %}<li><i class="icon-eye-close"></i> {% trans %}Not Reviewed{% endtrans %}</li>{% endif %}
- <li><i class="icon-time"></i> {{ thread.last|reltimesince }}</li>
- <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>
- <li><i class="icon-comment"></i> {% if thread.replies > 0 -%}
- {% trans count=thread.replies, replies=thread.replies|intcomma %}One reply{% pluralize %}{{ replies }} replies{% endtrans %}
- {%- else -%}
- {% trans %}No replies{% endtrans %}
- {%- endif %}</li>
- </ul>
- {%- endif %}
- </div>
- {% if message %}{{ macros.draw_message(message, 'alert-form') }}{% 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) }}
- {% endif %}
- {{ editor.editor(form.fields.post, get_button(), rows=8) }}
- </form>
- <div class="well well-small" id="md-border" style="display: none;">
- <div class="markdown" id="md-preview"></div>
- </div>
- {% endblock %}
- {% block javascripts %}
- {{ super() }}
- <script type="text/javascript">
- $(function($){
- var xhr = false;
- preview = $('#md-preview')
- $('#md-border').fadeIn(200);
- $('#id_post').keyup(function() {
- if (xhr != false) {
- xhr.abort();
- }
- xhr = $.ajax({
- type: "POST",
- url: "{% url 'md_preview' %}",
- data: { raw: $(this).val() },
- success: function(data) {
- $(preview).html(data);
- }
- });
- });
- });
- </script>
- {% endblock %}
- {% macro get_action() -%}
- {% if mode == 'new_thread' -%}
- {% url 'thread_new' forum=forum.pk, slug=forum.slug %}
- {%- elif mode == 'edit_thread' -%}
- NADA!
- {%- elif mode in ['new_post', 'new_post_quick'] -%}
- {% url 'thread_reply' thread=thread.pk, slug=thread.slug %}
- {%- elif mode == 'edit_post' -%}
- NADA!
- {%- endif %}
- {%- endmacro %}
- {% macro get_title() -%}
- {% if mode == 'new_thread' -%}
- {% trans %}Post New Thread{% endtrans %}
- {%- elif mode == 'edit_thread' -%}
- {% trans %}Edit Thread{% endtrans %}
- {%- elif mode in ['new_post', 'new_post_quick'] -%}
- {% trans %}Post New Reply{% endtrans %}
- {%- elif mode == 'edit_post' -%}
- {% trans %}Edit Reply{% endtrans %}
- {%- endif %}
- {%- endmacro %}
- {% macro get_button() -%}
- {% if mode == 'new_thread' -%}
- {% trans %}Post Thread{% endtrans %}
- {%- elif mode == 'edit_thread' -%}
- {% trans %}Edit Thread{% endtrans %}
- {%- elif mode in ['new_post', 'new_post_quick'] -%}
- {% trans %}Post Reply{% endtrans %}
- {%- elif mode == 'edit_post' -%}
- {% trans %}Edit Reply{% endtrans %}
- {%- endif %}
- {%- endmacro %}
|