1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 14:10:00 +00:00

Add markdown editor macro

This commit is contained in:
Nathan Yam 2017-05-14 14:55:40 +10:00
parent bc430d06b7
commit d3ad2503ae
2 changed files with 25 additions and 0 deletions

View file

@ -24,6 +24,30 @@
</div> </div>
{% endmacro %} {% endmacro %}
{% macro render_markdown_editor(field, field_name='') %}
{% if field.errors %}
<div class="form-group has-error">
{% else %}
<div class="form-group">
{% endif %}
<div class="markdown-editor" id="{{ field_name }}-markdown-editor">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#{{ field_name }}-tab" aria-controls="" role="tab" data-toggle="tab">Write</a></li>
<li role="presentation"><a href="#{{ field_name }}-preview" id="{{ field_name }}-preview-tab" aria-controls="preview" role="tab" data-toggle="tab">Preview</a></li>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane active" id="{{ field_name }}-tab" data-markdown-target="#{{ field_name }}-markdown-target">
{{ render_field(field, class_='form-control markdown-source') }}
</div>
<div role="tabpanel" class="tab-pane" id="{{ field_name }}-preview">
<div id="{{ field_name }}-markdown-target"></div>
</div>
</div>
</div>
{% endmacro %}
{% macro render_upload(field) %} {% macro render_upload(field) %}
{% if field.errors %} {% if field.errors %}
<div class="form-group has-error"> <div class="form-group has-error">

View file

@ -3,6 +3,7 @@
{% block body %} {% block body %}
{% from "_formhelpers.html" import render_field %} {% from "_formhelpers.html" import render_field %}
{% from "_formhelpers.html" import render_upload %} {% from "_formhelpers.html" import render_upload %}
{% from "_formhelpers.html" import render_markdown_editor %}
<h1>Upload Torrent</h1> <h1>Upload Torrent</h1>