mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 09:10:00 +00:00
Add markdown editor macro
This commit is contained in:
parent
bc430d06b7
commit
d3ad2503ae
|
@ -24,6 +24,30 @@
|
|||
</div>
|
||||
{% 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) %}
|
||||
{% if field.errors %}
|
||||
<div class="form-group has-error">
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
{% block body %}
|
||||
{% from "_formhelpers.html" import render_field %}
|
||||
{% from "_formhelpers.html" import render_upload %}
|
||||
{% from "_formhelpers.html" import render_markdown_editor %}
|
||||
|
||||
<h1>Upload Torrent</h1>
|
||||
|
||||
|
|
Loading…
Reference in a new issue