{% from '_maintenance_fields.html' import schedule_fields with context %} {% set page_title = 'Maintenance preview' if preview else 'Maintenance conflict' %} {% include '_header.html' %} {#- The refused write (ADR-0014). Two refusals land here, because the admin's situation is the same in both: **nothing was written**, and their own words are still theirs. One is the compare-and-set — the token the form carried no longer matches the stored pin, so both texts are shown, the stored one named and dated, and the re-submit carries the **refreshed** token. Two forms rather than one clever one: taking the stored words is a plain one-click submit, so it needs no JavaScript and no server-side "which field wins" rule. The other is an **expiry we will not accept** (`problem`): not one of the explicit duration/calendar forms, not in the future, or longer than a year. A zero or negative window used to be written happily and then swept away a tick later, taking the note and both authorships with it — a lost explanation behind a redirect that looked like success, which is exactly what this page exists to make impossible. Here the token is unchanged, because nothing about the stored pin moved — and so is what the expiry field had been filled with. The expiry field (ADR-0104 decision 5): what it shows and what the form says it was filled with come back in the editor's fields (`view`). Where the admin left the field as filled (`kept`) the route fills the editor again from the pin as it stands now, so saving their words keeps that expiry, and the button that would carry *their* expiry over the stored note has nothing to carry; where the pin is gone the field is a new pin's. In the panel the drawer frames (ADR-0147 decision 3) its forms and its ways back stay in the frame, each form sending `panel` with it, and the way back leads to the tab the write was sent from. **The editor comes back whole** (`view`, ADR-0150, landing 4): *Starts*, a repeat's fields, *Until*, *Not on*, the zone and the windows added by hand, as they were typed — so that a refused series carries the series' editor. A window set on a part a schedule stands on joins it, so no refusal's form turns a schedule into one window. Three more answers land here. A **preview** (`preview`): the editor's own button — *Preview*, *Add an interval*, an ×, *weekend*, *working week*, a day of the month or its paging (landing 5) — answered as a refusal is, in full, with what it would set beneath it and no word of a refusal, never at the form's `next`, which the drawer takes for a write gone through, the page saying it holds words so that the drawer asks before it drops them. An **Extend or End now refused** (`window_act`), whose own form comes back with the words and the end typed. And one that **arrived after its window closed** (`closed`): it says when the window closed, and offers *Set maintenance* filled with the end asked for, a window from now that joins the schedule where one still stands — nothing reopens a window by itself. -#} {% macro editor_form(view, token, button, joins=false) -%}
{{- panel_field() }} {%- if slug %}{% endif %} {%- if joins %}{% endif %} {{ schedule_fields(view, 'conflict', maintenance_default, maintenance_timezone) }}
{%- endmacro %}
{#- The node's path as every page writes one; `path` is what the form posted, which a node's own page spells without its leading slash, and is what these forms post back. -#}

Maintenance — {{ node_path }}{% if slug %} · one reason{% endif %}

{% if preview %}

A preview: nothing is saved until you choose {{ 'Save changes' if token else 'Set maintenance' }}.

{{ editor_form(view, token, 'Save changes' if token else 'Set maintenance') }}
Change nothing {% elif closed %}

Nothing was saved. This window {% if closed_at %}closed {{ closed_at | localtime }}{% else %}has closed{% endif %}, before what you sent arrived, and a window that closed is not opened again by itself.

Set maintenance{% if stored %}, joining its schedule{% endif %}

{{ editor_form(view, token, 'Set maintenance', joins=stored is not none) }}
Change nothing {% elif problem %}

Nothing was saved. {{ problem }}

{%- if window_act %}

{{ 'Extend this window' if window_act == 'extend' else 'End this window now' }}

{{- panel_field() }} {%- if slug %}{% endif %} {%- if window_act == 'extend' %}
Read as the end field is, from now, and later than this window's end. To end it sooner, use End now.
{%- endif %}
{%- else %}

Your note

{{ editor_form(view, token, 'Save') }} {%- endif %}
Change nothing {% elif stored %}

Nothing was saved. {{ stored.set_by or 'Someone else' }} changed this pin {{ stored.set_at | localtime }}, after the form you submitted was drawn.

Pinned by {{ stored.created_by or 'unknown' }} {{ stored.created_at | localtime }}; {% if stored.schedule %}{{ stored | sentence }}{% else %}expires {{ stored.expires_at | localtime }}{% endif %}.

The stored note

{% if stored.note and stored.note != 'maintenance' %}
{{ stored.note | markdown(node=node_path) }}
{% else %}

No explanation was given.

{% endif %}
{% if clearing %}

You asked to clear a pin that is no longer the one above. Clear it anyway, or leave it as it stands.

{{- panel_field() }} {%- if slug %}{% endif %}
Leave it pinned {% else %}

Your note

{{ editor_form(view, stored.token, 'Save mine, replacing the stored note') }}
{%- if not kept and view.repeat == 'once' and not view.added %}
{{- panel_field() }} {%- if slug %}{% endif %} {%- if view.starts %} {%- endif %}
{%- endif %} Change nothing {% endif %} {% else %}

Nothing was saved. The pin you were working on is gone — someone cleared it, or it expired — so this node is not in maintenance at all.

{% if clearing %}

There is nothing left to clear.

Back {% else %}

Pin it again

{{ editor_form(view, '', 'Set maintenance') }}
Leave it unpinned {% endif %} {% endif %}
{% include '_page_end.html' %}