123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- {% 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=forum.name) }}
- {%- endif %}{% endblock %}
- {% block breadcrumb %}{{ super() }} <span class="divider"><i class="icon-chevron-right"></i></span></li>
- {{ macros.parents_list(parents) }}
- <li><a href="{{ url(forum.type, forum=forum.pk, slug=forum.slug) }}">{{ forum.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
- {% if thread %}<li><a href="{{ url('thread', 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|short_string(42) }}{% else %}{{ forum.name }}{% endif %}</small></h1>
- {% if thread %}
- <ul class="unstyled header-stats">
- {{ get_info() }}
- </ul>
- {% endif %}
- </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">
- <article>
- {{ preview|markdown_final|safe }}
- </article>
- </div>
- </div>
- {% endif %}
- <form action="{{ get_action() }}" method="post">
- <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
- {% if 'thread_name' in form.fields %}
- {% if 'thread_prefix' in form.fields %}
- <div class="row">
- <div class="span6">
- {{ form_theme.row(form.thread_name, attrs={'class': 'span6'}) }}
- </div>
- <div class="span2">
- {{ form_theme.row(form.thread_prefix, attrs={'class': 'span2'}) }}
- </div>
- </div>
- {% else %}
- {{ form_theme.row(form.thread_name, attrs={'class': 'span8'}) }}
- {% endif %}
- <hr>
- <h4>{% trans %}Message Body{% endtrans %}</h4>
- {% endif %}
- {{ editor.editor(form.post, get_button(), rows=8, zen=True, extra=get_extra()) }}
- {% if 'edit_reason' in form.fields %}
- {{ form_theme.row(form.edit_reason, attrs={'class': 'span8'}) }}
- {% endif %}
- {% if 'poll_question' in form.fields or 'poll_delete' in form.fields %}
- <hr>
- <h4>{% if thread and thread.poll %}{% trans %}Edit Poll{% endtrans %}{% else %}{% trans %}Create Poll{% endtrans %}{% endif %}</h4>
- {% if 'poll_question' in form.fields %}
- {{ form_theme.row(form.poll_question, attrs={'class': 'span8'}) }}
- {% if thread and thread.poll %}
- <div class="control-group">
- <label class="control-label">{% trans %}Edit Poll Choices{% endtrans %}:</label>
- <div class="controls">
- {% for option in thread.poll.option_set.all() %}
- <div>
- <input type="text" name="poll_current_choices[{{ option.pk }}]" value="{{ option.name }}" class="span8">
- </div>
- {% endfor %}
- </div>
- <p class="help-block">{% trans %}To delete existing choice, empty its text input.{% endtrans %}</p>
- </div>
- {% endif %}
- {{ form_theme.row(form.poll_choices, attrs={'class': 'span8', 'rows': 4}) }}
- {{ form_theme.row(form.poll_max_choices, attrs={'class': 'span8'}) }}
- {{ form_theme.row(form.poll_length, attrs={'class': 'span8'}) }}
- {% if 'poll_public' in form.fields %}
- {{ form_theme.row(form.poll_public, attrs={'inline': lang_poll_public()}) }}
- {% endif %}
- {{ form_theme.row(form.poll_changing_votes, attrs={'inline': lang_poll_changing_votes()}) }}
- {% endif %}
- {% if 'poll_delete' in form.fields %}
- {{ form_theme.row(form.poll_delete, attrs={'inline': lang_poll_delete()}) }}
- {% endif %}
- {% endif %}
- {% if intersect(form.fields, ('thread_weight', 'close_thread')) %}
- <hr>
- <div class="control-group">
- <label class="control-label">{% trans %}Thread Status{% endtrans %}:</label>
- <div class="controls">
- {% if 'thread_weight' in form.fields %}
- {{ form_theme.field(form.thread_weight, attrs={'class': 'span8'}) }}
- {% endif %}
- {% if 'close_thread' in form.fields %}
- <label class="checkbox">
- {{ form_theme.field(form.close_thread) }}
- {% if thread.closed %}
- {% trans %}Open thread{% endtrans %}
- {% else %}
- {% trans %}Close thread{% endtrans %}
- {% endif %}
- </label>
- {% endif %}
- </div>
- </div>
- {% 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>
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- {% endblock %}
- {% block stylesheets %}{{ super() }}
- <link href="{{ STATIC_URL }}cranefly/highlight/styles/monokai.css" rel="stylesheet">
- {% endblock %}
- {% block javascripts %}
- {{ editor.zen() }}
- {{ 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('thread_start', forum=forum.pk, slug=forum.slug) }}
- {%- elif action == 'edit_thread' -%}
- {{ url('thread_edit', thread=thread.pk, slug=thread.slug) }}
- {%- elif action in 'new_reply' -%}
- {%- if quote -%}
- {{ url('thread_reply', thread=thread.pk, slug=thread.slug, quote=quote.pk) }}
- {%- else -%}
- {{ url('thread_reply', thread=thread.pk, slug=thread.slug) }}
- {%- endif -%}
- {%- elif action == 'edit_reply' -%}
- {{ url('post_edit', thread=thread.pk, slug=thread.slug, post=post.pk) }}
- {%- endif %}
- {%- endmacro %}
- {% macro get_title() -%}
- {% if action == 'new_thread' -%}
- {% trans %}Post New Thread{% endtrans %}
- {%- elif action == 'edit_thread' -%}
- {% trans %}Edit Thread{% endtrans %}
- {%- elif action == 'new_reply' -%}
- {% trans %}Post New Reply{% endtrans %}
- {%- elif action == 'edit_reply' -%}
- {% trans %}Edit Reply{% endtrans %}
- {%- endif %}
- {%- endmacro %}
- {% macro get_info() -%}
- {% if action == 'edit_reply' -%}
- {% if post.moderated %}<li><i class="icon-eye-close"></i> {% trans %}Not Reviewed{% endtrans %}</li>{% endif %}
- <li><i class="icon-time"></i> <a href="{{ url('thread_find', thread=thread.pk, slug=thread.slug, post=post.pk) }}">{{ post.date|reltimesince }}</a></li>
- <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>
- <li><i class="icon-pencil"></i> {% if post.edits > 0 -%}
- {% trans edits=post.edits %}One edit{% pluralize %}{{ edits }} edits{% endtrans %}
- {%- else -%}
- {% trans %}First edit{% endtrans %}
- {%- endif %}</li>
- {%- else -%}
- {% if thread.moderated %}<li><i class="icon-eye-close"></i> {% trans %}Not Reviewed{% endtrans %}</li>{% endif %}
- {% if action == 'edit_thread' %}
- <li><i class="icon-time"></i> <a href="{{ url('thread_find', thread=thread.pk, slug=thread.slug, post=thread.start_post_id) }}">{{ thread.start|reltimesince }}</a></li>
- {% else %}
- <li><i class="icon-time"></i> <a href="{{ url('thread_new', thread=thread.pk, slug=thread.slug) }}">{{ thread.last|reltimesince }}</a></li>
- {% endif %}
- <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>
- {%- endif %}
- {% if thread.closed %}<li><i class="icon-lock"></i> {% trans %}Locked{% endtrans %}</li>{% endif %}
- {%- endmacro %}
- {% macro get_button() -%}
- {% if action == 'new_thread' -%}
- {% trans %}Start Thread{% endtrans %}
- {%- elif action == 'new_reply' -%}
- {% trans %}Post Reply{% 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 %}
- {% macro lang_poll_public() -%}
- {% trans %}Make voting in this poll public.{% endtrans %}
- {%- endmacro %}
- {% macro lang_poll_changing_votes() -%}
- {% trans %}Allow users to change their votes.{% endtrans %}
- {%- endmacro %}
- {% macro lang_poll_delete() -%}
- {% trans %}Delete this poll from thread.{% endtrans %}
- {%- endmacro %}
|