Add the possibility to save an article as draft

This commit is contained in:
Bat
2018-09-10 19:38:19 +01:00
parent fcdd3d4c1a
commit 8879935925
7 changed files with 56 additions and 18 deletions
+2 -1
View File
@@ -18,8 +18,9 @@
name=article.author.name,
link_4="</a>")
}}
⋅ {{ article.date | date(format="%B %e") }}
{% if article.post.published %}⋅ {{ article.date | date(format="%B %e") }}{% endif %}
⋅ <a href="/~/{{ article.blog.fqn }}/">{{ article.blog.title }}</a>
{% if not article.post.published %}⋅ {{ "Draft" | _ }}{% endif %}
</p>
</div>
{% endmacro post_card %}
+3
View File
@@ -29,6 +29,9 @@
&mdash;
<a href="{{ article.url}}delete" onclick="return confirm('Are you sure you?')">{{ "Delete this article" | _ }}</a>
{% endif %}
{% if not article.post.published %}
<span class="badge">{{ "Draft" }}</span>
{% endif %}
</p>
<article>
{{ article.post.content | safe }}
+12 -1
View File
@@ -35,10 +35,21 @@
{% 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) }}
{% 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 %}
<input type="submit" value="{{ "Publish" | _ }}" />
{% 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>