{% load static %}
{% load i18n %}
{% load l10n %}
{% load humanize %}
{% load mastodon %}
{% load thumb %}
<dialog open
        class="tag-editor"
        _="on close_dialog add .closing then wait for animationend then remove me">
  <article>
    <header>
      <link to="#"
            aria-label="Close"
            class="close"
            _="on click trigger close_dialog" />
      <strong>{% trans 'Edit' %} {{ tag.title }}</strong>
    </header>
    <div>
      <form action="{% url 'journal:user_tag_edit' %}?tag={{ tag.title }}"
            method="post">
        {% csrf_token %}
        <input type="hidden" name="id" value="{{ tag.id }}">
        <input name="title" type="text" value="{{ tag.title }}" required>
        <fieldset>
          <label for="_pinned">
            <input role="switch"
                   type="checkbox"
                   name="pinned"
                   value="1"
                   {% if tag.pinned %}checked{% endif %}
                   id="_pinned">
            {% trans "Pin" %}
          </label>
        </fieldset>
        <fieldset>
          <input type="radio"
                 name="visibility"
                 value="0"
                 required=""
                 id="id_visibility_0"
                 {% if tag.visibility == 0 %}checked{% endif %}>
          <label for="id_visibility_0">{% trans "Public" %}</label>
          <input type="radio"
                 name="visibility"
                 value="2"
                 required=""
                 id="id_visibility_2"
                 {% if tag.visibility != 0 %}checked{% endif %}>
          <label for="id_visibility_2">{% trans "Personal" %}</label>
        </fieldset>
        <input type="submit" class="button float-right" value="{% trans "Save" %}">
        <small>{% trans "Personal tags are not included in public index. However, if you use this tag when marking an item publicly, it might still be visible to others." %}</small>
        <label for="_delete">
          <input type="checkbox" name="delete" value="1" id="_delete">
          {% trans "Delete this tag" %}
        </label>
      </form>
    </div>
  </article>
</dialog>
