{% load static %}
{% load i18n %}
{% load mastodon %}
<!DOCTYPE html>
<html lang="zh" class="content-page">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{{ site_name }} -
      {% if form.instance.id %}
        {% trans 'Edit' %} {{ form.instance.display_title }}
      {% else %}
        {% trans 'Create' %}
      {% endif %}
    </title>
    {% include "common_libs.html" %}
    <style>
      aside details {
        margin-bottom: 1rem;
        padding: 1rem;
        border: var(--pico-muted-color) solid 1px;
      }
      aside summary {
        cursor: pointer;
        font-weight: bold;
      }
      main>div {
        margin-bottom: 4rem;
      }
    </style>
  </head>
  <body>
    {% include "_header.html" %}
    <main>
      <div class="grid__main">
        {% if item.is_deleted %}
          <i>{% trans "Item has been deleted." %}</i>
        {% endif %}
        {% if item.merged_to_item %}
          <i>{% trans "Item contains sub-items." %}</i>
        {% endif %}
        <form method="post"
              enctype="multipart/form-data"
              _=" init set .rjf-add-button's innerHTML to '➕' end">
          {% csrf_token %}
          {{ form.media }}
          {{ form }}
          <div class="grid">
            {% if not item or item.editable or request.user.is_staff %}
              <input type="submit" value="{% trans 'Save' %}">
            {% endif %}
            <input type="reset"
                   value="{% trans 'Cancel' %}"
                   onclick="{% if item %}window.location='{{ item.url }}'{% else %}history.go(-1){% endif %}">
          </div>
        </form>
      </div>
      <aside class="grid__aside">
        {% include "_sidebar_edit.html" %}
      </aside>
    </main>
    {% include "_footer.html" %}
  </body>
</html>
