{#- vim: set et ts=8 sts=4 sw=4 ai: -#} {% extends "page.html" %} {% from "snippets/diff_side_by_side.html" import diff_side_by_side %} {% block content %} {#- the delta is empty for less than a second ago -#} {%- macro time_ago(datetime) -%} {%- set ago = datetime|format_datetime("deltanow") -%} {{ ago ~ " ago" if ago else "just now" }} {%- endmacro -%} {%- set draft_saved = time_ago(draft_datetime) -%} {#- discarding the draft opens the editor with the latest saved version, which is the left side of the diff, unless the page has been changed since the draft was started -#} {%- if not changes %} {%- set discard_label = "Discard draft" %} {%- elif page_exists %} {%- set discard_label = "Discard draft, edit latest version" %} {%- else %} {%- set discard_label = "Discard draft, start a new page" %} {%- endif %} {%- macro draft_button(action, label, classes) -%}
{%- endmacro %}

Continue editing draft?

You have a draft of {{pagepath}}, saved {{ draft_saved }}.
{% if changes is none or changes %} {% endif %} {% if not draft_diff %} {#- without a diff, there are no sides to place the buttons above #}
{{ draft_button("edit", "Continue editing draft", "btn-primary mr-15 mb-10") }} {{ draft_button("discard", discard_label, "mb-10") }}
{% endif %}
{% if diff_against_stored %}

Compared to the stored version, since the version the draft is based on is not available.

{% endif %} {% if draft_diff %} {%- macro revision_link(revision) -%} {%- if page_exists %} {{revision}} {%- else %} {{revision}} {%- endif -%} {%- endmacro %} {% call diff_side_by_side(draft_diff, id="draft-diff") %} {{ draft_button("discard", discard_label, "") }} {{ draft_button("edit", "Continue editing draft", "btn-primary") }} {%- if diff_against_stored %} Latest saved version{% if current_revision %}{{ revision_link(current_revision) }}{% endif %} {%- elif not draft_revision %} New page {%- elif changes %} Version the draft is based on{{ revision_link(draft_revision) }} {%- else %} Latest saved version{{ revision_link(draft_revision) }} {%- endif -%} Your draft saved {{ draft_saved }} {% endcall %} {% else %}

The draft has no changes.

{% endif %} {% endblock %}