mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
combine add_..._post templates into one add_post
This commit is contained in:
parent
7219926bfd
commit
841fd9ec43
6 changed files with 56 additions and 411 deletions
|
@ -553,7 +553,7 @@ def add_discussion_post(actor):
|
|||
if community.posting_warning:
|
||||
flash(community.posting_warning)
|
||||
|
||||
return render_template('community/add_discussion_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
return render_template('community/add_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.id),
|
||||
|
@ -633,7 +633,7 @@ def add_image_post(actor):
|
|||
form.communities.data = community.id
|
||||
form.notify_author.data = True
|
||||
|
||||
return render_template('community/add_image_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
return render_template('community/add_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.id),
|
||||
|
@ -713,7 +713,7 @@ def add_link_post(actor):
|
|||
form.communities.data = community.id
|
||||
form.notify_author.data = True
|
||||
|
||||
return render_template('community/add_link_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
return render_template('community/add_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.id),
|
||||
|
@ -793,7 +793,7 @@ def add_video_post(actor):
|
|||
form.communities.data = community.id
|
||||
form.notify_author.data = True
|
||||
|
||||
return render_template('community/add_video_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
return render_template('community/add_post.html', title=_('Add post to community'), form=form, community=community,
|
||||
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.id),
|
||||
|
@ -862,7 +862,7 @@ def add_poll_post(actor):
|
|||
if community.posting_warning:
|
||||
flash(community.posting_warning)
|
||||
|
||||
return render_template('community/add_poll_post.html', title=_('Add poll to community'), form=form, community=community,
|
||||
return render_template('community/add_post.html', title=_('Add poll to community'), form=form, community=community,
|
||||
markdown_editor=current_user.markdown_editor, low_bandwidth=False, actor=actor,
|
||||
moderating_communities=moderating_communities(current_user.get_id()),
|
||||
joined_communities=joined_communities(current_user.id),
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
{% 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_field %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-8 position-relative main_pane">
|
||||
<h1>{{ _('Create post') }}</h1>
|
||||
<form method="post" enctype="multipart/form-data" role="form">
|
||||
{{ form.csrf_token() }}
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="type_of_post">
|
||||
{{ _('Type of post') }}
|
||||
</label>
|
||||
{% include 'community/_add_post_types.html' %}
|
||||
</div>
|
||||
{{ render_field(form.communities) }}
|
||||
{{ render_field(form.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.body) }}
|
||||
{% if not low_bandwidth %}
|
||||
{% if markdown_editor %}
|
||||
<script nonce="{{ session['nonce'] }}">
|
||||
window.addEventListener("load", function () {
|
||||
var downarea = new DownArea({
|
||||
elem: document.querySelector('#body'),
|
||||
resize: DownArea.RESIZE_VERTICAL,
|
||||
hide: ['heading', 'bold-italic'],
|
||||
});
|
||||
setupAutoResize('body');
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ render_field(form.tags) }}
|
||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-3">
|
||||
{{ render_field(form.notify_author) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.sticky) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfw) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfl) }}
|
||||
</div>
|
||||
<div class="col post_language_chooser">
|
||||
{{ render_field(form.language_id) }}
|
||||
</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 mb-3">
|
||||
<div class="card-header">
|
||||
<h2>{{ community.title }}</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>{{ community.description_html|safe if community.description_html else '' }}</p>
|
||||
<p>{{ community.rules_html|safe if community.rules_html else '' }}</p>
|
||||
{% if len(mods) > 0 and not community.private_mods %}
|
||||
<h3>Moderators</h3>
|
||||
<ul class="moderator_list">
|
||||
{% for mod in mods %}
|
||||
<li>{{ render_username(mod) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if rss_feed %}
|
||||
<p class="mt-4">
|
||||
<a class="no-underline" href="{{ rss_feed }}" rel="nofollow"><span class="fe fe-rss"></span> RSS feed</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% include "_inoculation_links.html" %}
|
||||
</aside>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,92 +0,0 @@
|
|||
{% 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_field %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-8 position-relative main_pane">
|
||||
<h1>{{ _('Create post') }}</h1>
|
||||
<form method="post" enctype="multipart/form-data" role="form">
|
||||
{{ form.csrf_token() }}
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="type_of_post">
|
||||
{{ _('Type of post') }}
|
||||
</label>
|
||||
{% include 'community/_add_post_types.html' %}
|
||||
</div>
|
||||
{{ render_field(form.communities) }}
|
||||
|
||||
{{ render_field(form.title) }}
|
||||
{{ render_field(form.link_url) }}
|
||||
{{ render_field(form.body) }}
|
||||
{% if not low_bandwidth %}
|
||||
{% if markdown_editor %}
|
||||
<script nonce="{{ session['nonce'] }}">
|
||||
window.addEventListener("load", function () {
|
||||
var downarea = new DownArea({
|
||||
elem: document.querySelector('#body'),
|
||||
resize: DownArea.RESIZE_VERTICAL,
|
||||
hide: ['heading', 'bold-italic'],
|
||||
});
|
||||
setupAutoResize('body');
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ render_field(form.tags) }}
|
||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-3">
|
||||
{{ render_field(form.notify_author) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.sticky) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfw) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfl) }}
|
||||
</div>
|
||||
<div class="col post_language_chooser">
|
||||
{{ render_field(form.language_id) }}
|
||||
</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 mb-3">
|
||||
<div class="card-header">
|
||||
<h2>{{ community.title }}</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>{{ community.description_html|safe if community.description_html else '' }}</p>
|
||||
<p>{{ community.rules_html|safe if community.rules_html else '' }}</p>
|
||||
{% if len(mods) > 0 and not community.private_mods %}
|
||||
<h3>Moderators</h3>
|
||||
<ul class="moderator_list">
|
||||
{% for mod in mods %}
|
||||
<li>{{ render_username(mod) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if rss_feed %}
|
||||
<p class="mt-4">
|
||||
<a class="no-underline" href="{{ rss_feed }}" rel="nofollow"><span class="fe fe-rss"></span> RSS feed</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% include "_inoculation_links.html" %}
|
||||
</aside>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,128 +0,0 @@
|
|||
{% 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_field %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-8 position-relative main_pane">
|
||||
<h1>{{ _('Create post') }}</h1>
|
||||
<form method="post" enctype="multipart/form-data" role="form">
|
||||
{{ form.csrf_token() }}
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="type_of_post">
|
||||
{{ _('Type of post') }}
|
||||
</label>
|
||||
{% include 'community/_add_post_types.html' %}
|
||||
</div>
|
||||
|
||||
{{ render_field(form.communities) }}
|
||||
{{ render_field(form.title) }}
|
||||
{{ render_field(form.body) }}
|
||||
{% if not low_bandwidth %}
|
||||
{% if markdown_editor %}
|
||||
<script nonce="{{ session['nonce'] }}">
|
||||
window.addEventListener("load", function () {
|
||||
var downarea = new DownArea({
|
||||
elem: document.querySelector('#body'),
|
||||
resize: DownArea.RESIZE_VERTICAL,
|
||||
hide: ['heading', 'bold-italic'],
|
||||
});
|
||||
setupAutoResize('body');
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<fieldset id="pollChoicesFieldset">
|
||||
<legend>{{ _('Poll choices') }}</legend>
|
||||
<div class="form-group">
|
||||
{{ form.choice_1(class_="form-control", **{"placeholder": "First choice"}) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ form.choice_2(class_="form-control", **{"placeholder": "Second choice"}) }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_3(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_4(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_5(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_6(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_7(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_8(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_9(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_10(class_="form-control") }}
|
||||
</div>
|
||||
<button id="addPollChoice" type="button" class="btn btn-primary">{{ _('Add choice') }}</button>
|
||||
</fieldset>
|
||||
{{ render_field(form.mode) }}
|
||||
{{ render_field(form.finish_in) }}
|
||||
{{ render_field(form.local_only) }}
|
||||
{{ render_field(form.tags) }}
|
||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-3">
|
||||
{{ render_field(form.notify_author) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.sticky) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfw) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfl) }}
|
||||
</div>
|
||||
<div class="col post_language_chooser">
|
||||
{{ render_field(form.language_id) }}
|
||||
</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 mb-3">
|
||||
<div class="card-header">
|
||||
<h2>{{ community.title }}</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>{{ community.description_html|safe if community.description_html else '' }}</p>
|
||||
<p>{{ community.rules_html|safe if community.rules_html else '' }}</p>
|
||||
{% if len(mods) > 0 and not community.private_mods %}
|
||||
<h3>Moderators</h3>
|
||||
<ul class="moderator_list">
|
||||
{% for mod in mods %}
|
||||
<li>{{ render_username(mod) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if rss_feed %}
|
||||
<p class="mt-4">
|
||||
<a class="no-underline" href="{{ rss_feed }}" rel="nofollow"><span class="fe fe-rss"></span> RSS feed</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% include "_inoculation_links.html" %}
|
||||
</aside>
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -20,6 +20,16 @@
|
|||
|
||||
{{ render_field(form.communities) }}
|
||||
{{ render_field(form.title) }}
|
||||
{% if post.type == POST_TYPE_LINK %}
|
||||
{{ render_field(form.link_url) }}
|
||||
{% elif post.type == POST_TYPE_IMAGE %}
|
||||
{{ render_field(form.image_file) }}
|
||||
{{ render_field(form.image_alt_text) }}
|
||||
<small class="field_hint">{{ _('Describe the image, to help visually impaired people.') }}</small>
|
||||
{% elif post.type == POST_TYPE_VIDEO %}
|
||||
{{ render_field(form.video_url) }}
|
||||
<p class="small field_hint">{{ _('Provide a URL ending with .mp4 or .webm.') }}</p>
|
||||
{% endif %}
|
||||
{{ render_field(form.body) }}
|
||||
{% if not low_bandwidth %}
|
||||
{% if markdown_editor %}
|
||||
|
@ -37,6 +47,47 @@
|
|||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if post.type == POST_TYPE_POLL %}
|
||||
<fieldset id="pollChoicesFieldset">
|
||||
<legend>{{ _('Poll choices') }}</legend>
|
||||
<div class="form-group">
|
||||
{{ form.choice_1(class_="form-control", **{"placeholder": "First choice"}) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
{{ form.choice_2(class_="form-control", **{"placeholder": "Second choice"}) }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_3(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_4(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_5(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_6(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_7(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_8(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_9(class_="form-control") }}
|
||||
</div>
|
||||
<div class="form-group" style="display: none;">
|
||||
{{ form.choice_10(class_="form-control") }}
|
||||
</div>
|
||||
<button id="addPollChoice" type="button" class="btn btn-primary">{{ _('Add choice') }}</button>
|
||||
</fieldset>
|
||||
{{ render_field(form.mode) }}
|
||||
{{ render_field(form.finish_in) }}
|
||||
{{ render_field(form.local_only) }}
|
||||
{% endif %}
|
||||
|
||||
{{ render_field(form.tags) }}
|
||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
||||
|
|
@ -1,93 +0,0 @@
|
|||
{% 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_field %}
|
||||
|
||||
{% block app_content %}
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-8 position-relative main_pane">
|
||||
<h1>{{ _('Create post') }}</h1>
|
||||
<form method="post" enctype="multipart/form-data" role="form">
|
||||
{{ form.csrf_token() }}
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="type_of_post">
|
||||
{{ _('Type of post') }}
|
||||
</label>
|
||||
{% include 'community/_add_post_types.html' %}
|
||||
</div>
|
||||
{{ render_field(form.communities) }}
|
||||
|
||||
{{ render_field(form.title) }}
|
||||
{{ render_field(form.video_url) }}
|
||||
<p class="small field_hint">{{ _('Provide a URL ending with .mp4 or .webm.') }}</p>
|
||||
{{ render_field(form.body) }}
|
||||
{% if not low_bandwidth %}
|
||||
{% if markdown_editor %}
|
||||
<script nonce="{{ session['nonce'] }}">
|
||||
window.addEventListener("load", function () {
|
||||
var downarea = new DownArea({
|
||||
elem: document.querySelector('#body'),
|
||||
resize: DownArea.RESIZE_VERTICAL,
|
||||
hide: ['heading', 'bold-italic'],
|
||||
});
|
||||
setupAutoResize('body');
|
||||
});
|
||||
</script>
|
||||
{% else %}
|
||||
<a href="#" aria-hidden="true" class="markdown_editor_enabler create_post_markdown_editor_enabler" data-id="body">{{ _('Enable markdown editor') }}</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{{ render_field(form.tags) }}
|
||||
<small class="field_hint">{{ _('Separate each tag with a comma.') }}</small>
|
||||
|
||||
<div class="row mt-4">
|
||||
<div class="col-md-3">
|
||||
{{ render_field(form.notify_author) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.sticky) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfw) }}
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
{{ render_field(form.nsfl) }}
|
||||
</div>
|
||||
<div class="col post_language_chooser">
|
||||
{{ render_field(form.language_id) }}
|
||||
</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 mb-3">
|
||||
<div class="card-header">
|
||||
<h2>{{ community.title }}</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p>{{ community.description_html|safe if community.description_html else '' }}</p>
|
||||
<p>{{ community.rules_html|safe if community.rules_html else '' }}</p>
|
||||
{% if len(mods) > 0 and not community.private_mods %}
|
||||
<h3>Moderators</h3>
|
||||
<ul class="moderator_list">
|
||||
{% for mod in mods %}
|
||||
<li>{{ render_username(mod) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% if rss_feed %}
|
||||
<p class="mt-4">
|
||||
<a class="no-underline" href="{{ rss_feed }}" rel="nofollow"><span class="fe fe-rss"></span> RSS feed</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% include "_inoculation_links.html" %}
|
||||
</aside>
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Reference in a new issue