Plume/templates/posts/new.html.tera

69 lines
2.6 KiB
Plaintext

{% extends "base" %}
{% import "macros" as macros %}
{% block title %}
{% if editing %}
{{ "Edit {{ post }}" | _(post=form.title) }}
{% else %}
{{ "New post" | _ }}
{% endif %}
{% endblock title %}
{% block content %}
<h1>
{% if editing %}
{{ "Edit {{ post }}" | _(post=form.title) }}
{% else %}
{{ "Create a post" | _ }}
{% endif %}
</h1>
<form class="new-post" method="post">
{{ macros::input(name="title", label="Title", errors=errors, form=form, props="required") }}
{{ macros::input(name="subtitle", label="Subtitle", errors=errors, form=form, optional=true) }}
{% if errors is defined and errors.content %}
{% for err in errors.content %}
<p class="error">{{ err.message | default(value="Unknown error") | _ }}</p>
{% endfor %}
{% endif %}
<label for="plume-editor">{{ "Content" | _ }}<small>{{ "Markdown is supported" | _ }}</small></label>
<textarea id="plume-editor" name="content" rows="20">{{ form.content | default(value="") }}</textarea>
{{ macros::input(name="tags", label="Tags, separated by commas", errors=errors, form=form, optional=true) }}
{% set license_infos = "Default license will be {{ instance.default_license }}" | _(instance=instance) %}
{{ macros::input(name="license", label="License", errors=errors, form=form, optional=true, details=license_infos) }}
<label for="cover">{{ "Illustration" | _ }}<small>{{ "Optional" | _ }}</small></label>
<select id="cover" name="cover">
<option value="none" {% if form is undefined or form.cover is undefined %}selected{% endif %}>{{ "None" | _ }}</option>
{% for media in medias %}
{% if media.category == "image" %}
<option value="{{ media.id }}" {% if form is defined and form.cover is defined and form.cover == media.id %}selected{% endif %}>
{{ media.alt_text | default(value=media.content_warning) }}
</option>
{% endif %}
{% endfor %}
</select>
{% if is_draft %}
<label for="draft">
<input type="checkbox" name="draft" id="draft" checked>
{{ "This is a draft, don't publish it yet." | _ }}
</label>
{% endif %}
{% if editing %}
<input type="submit" value="{{ "Update" | _ }}" />
{% else %}
{% if is_draft %}
<input type="submit" value="{{ "Update or publish" | _ }}" />
{% else %}
<input type="submit" value="{{ "Publish" | _ }}" />
{% endif %}
{% endif %}
</form>
<script src="/static/js/autoExpand.js"></script>
{% endblock content %}