mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-24 11:51:27 -08:00
153 lines
No EOL
7.1 KiB
HTML
153 lines
No EOL
7.1 KiB
HTML
{% if theme() and file_exists('app/templates/themes/' + theme() + '/base.html') %}
|
|
{% extends 'themes/' + theme() + '/base.html' %}
|
|
{% else %}
|
|
{% extends "base.html" %}
|
|
{% endif %} %}
|
|
{% from 'bootstrap/form.html' import render_form, render_field %}
|
|
|
|
{% block app_content %}
|
|
<script nonce="{{ session['nonce'] }}" type="text/javascript">
|
|
window.addEventListener("load", function () {
|
|
var type = document.forms[0].elements['type'].value;
|
|
var toClick = undefined;
|
|
switch(type) {
|
|
case '':
|
|
case 'discussion':
|
|
toClick = document.getElementById('discussion-tab');
|
|
break;
|
|
case 'link':
|
|
toClick = document.getElementById('link-tab');
|
|
break;
|
|
case 'image':
|
|
toClick = document.getElementById('image-tab');
|
|
break;
|
|
case 'poll':
|
|
toClick = document.getElementById('poll-tab');
|
|
break;
|
|
}
|
|
if(toClick) {
|
|
toClick.click();
|
|
}
|
|
|
|
var downarea = new DownArea({
|
|
elem: document.querySelector('#discussion_body'),
|
|
resize: DownArea.RESIZE_VERTICAL,
|
|
hide: ['heading', 'bold-italic'],
|
|
value: {{ form.discussion_body.data | tojson | safe }}
|
|
});
|
|
setupAutoResize('discussion_body');
|
|
});
|
|
</script>
|
|
<div class="row">
|
|
<div class="col-12 col-md-8 position-relative main_pane">
|
|
<h1>{{ _('Edit post') }}</h1>
|
|
<form method="post" enctype="multipart/form-data" role="form">
|
|
{{ form.csrf_token() }}
|
|
{{ render_field(form.communities) }}
|
|
<nav id="post_type_chooser">
|
|
<div class="nav nav-tabs nav-justified" id="typeTab" role="tablist">
|
|
<button class="nav-link active" id="discussion-tab" data-bs-toggle="tab" data-bs-target="#discussion-tab-pane"
|
|
type="button" role="tab" aria-controls="discussion-tab-pane" aria-selected="true">Discussion</button>
|
|
<button class="nav-link" id="link-tab" data-bs-toggle="tab" data-bs-target="#link-tab-pane"
|
|
type="button" role="tab" aria-controls="link-tab-pane" aria-selected="false">Link</button>
|
|
<button class="nav-link" id="image-tab" data-bs-toggle="tab" data-bs-target="#image-tab-pane"
|
|
type="button" role="tab" aria-controls="image-tab-pane" aria-selected="false" {{ images_disabled }}>Image</button>
|
|
<button class="nav-link" id="poll-tab" data-bs-toggle="tab" data-bs-target="#poll-tab-pane"
|
|
type="button" role="tab" aria-controls="poll-tab-pane" aria-selected="false" disabled>Poll</button>
|
|
</div>
|
|
</nav>
|
|
<div class="tab-content" id="myTabContent">
|
|
<div class="tab-pane fade show active" id="discussion-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">
|
|
{{ render_field(form.discussion_title) }}
|
|
{{ render_field(form.discussion_body) }}
|
|
{% if markdown_editor %}
|
|
<script nonce="{{ session['nonce'] }}">
|
|
window.addEventListener("load", function () {
|
|
var downarea = new DownArea({
|
|
elem: document.querySelector('#discussion_body'),
|
|
resize: DownArea.RESIZE_VERTICAL,
|
|
hide: ['heading', 'bold-italic'],
|
|
value: {{ form.discussion_body.data | tojson | safe }},
|
|
});
|
|
setupAutoResize('discussion_body');
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
</div>
|
|
<div class="tab-pane fade" id="link-tab-pane" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">
|
|
{{ render_field(form.link_title) }}
|
|
{{ render_field(form.link_url) }}
|
|
{{ render_field(form.link_body) }}
|
|
{% if markdown_editor %}
|
|
<script nonce="{{ session['nonce'] }}">
|
|
window.addEventListener("load", function () {
|
|
var downarea = new DownArea({
|
|
elem: document.querySelector('#link_body'),
|
|
resize: DownArea.RESIZE_VERTICAL,
|
|
hide: ['heading', 'bold-italic'],
|
|
value: {{ form.link_body.data | tojson | safe }},
|
|
});
|
|
setupAutoResize('link_body');
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
</div>
|
|
<div class="tab-pane fade" id="image-tab-pane" role="tabpanel" aria-labelledby="contact-tab" tabindex="0">
|
|
{{ render_field(form.image_title) }}
|
|
{{ render_field(form.image_file) }}
|
|
{{ render_field(form.image_alt_text) }}
|
|
<small class="field_hint">{{ _('Describe the image, to help visually impaired people.') }}</small>
|
|
{{ render_field(form.image_body) }}
|
|
{% if markdown_editor %}
|
|
<script nonce="{{ session['nonce'] }}">
|
|
window.addEventListener("load", function () {
|
|
var downarea = new DownArea({
|
|
elem: document.querySelector('#image_body'),
|
|
resize: DownArea.RESIZE_VERTICAL,
|
|
hide: ['heading', 'bold-italic'],
|
|
value: {{ form.image_body.data | tojson | safe }},
|
|
});
|
|
setupAutoResize('image_body');
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
</div>
|
|
<div class="tab-pane fade" id="poll-tab-pane" role="tabpanel" aria-labelledby="disabled-tab" tabindex="0">
|
|
Poll
|
|
</div>
|
|
</div>
|
|
{{ render_field(form.post_type) }}
|
|
<div class="row mt-4">
|
|
<div class="col-md-3">
|
|
{{ render_field(form.notify_author) }}
|
|
</div>
|
|
<div class="col-md-1">
|
|
{{ render_field(form.nsfw) }}
|
|
</div>
|
|
<div class="col-md-1">
|
|
{{ render_field(form.nsfl) }}
|
|
</div>
|
|
|
|
<div class="col">
|
|
|
|
</div>
|
|
</div>
|
|
|
|
{{ render_field(form.submit) }}
|
|
</form>
|
|
</div>
|
|
|
|
<aside id="side_pane" class="col-12 col-md-4 side_pane" role="complementary">
|
|
<div class="card mt-3">
|
|
<div class="card-header">
|
|
<h2>{{ post.community.title }}</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<p>{{ post.community.description|safe }}</p>
|
|
<p>{{ post.community.rules|safe }}</p>
|
|
</div>
|
|
</div>
|
|
</aside>
|
|
{% include "_inoculation_links.html" %}
|
|
</div>
|
|
{% endblock %} |