{% extends "misago/admin/generic/form.html" %}
{% load i18n misago_admin_form %}


{% block title %}
{% if target.pk %}
  {{ target }}
{% else %}
  {% trans "New category" context "admin category form" %}
{% endif %} | {{ active_link.name }} | {{ block.super }}
{% endblock title %}


{% block page-header %}
{{ block.super }}
{% if target.pk %}
  <small>
    {{ target }}
  </small>
{% endif %}
{% endblock page-header %}


{% block page-actions %}
{% if target.pk %}
  <div class="col-auto page-action">
    <a href="{% url 'misago:admin:categories:permissions' pk=target.pk %}" class="btn btn-primary btn-sm">
      <span class="fa fa-adjust"></span>
      {% trans "Edit permissions" context "admin categories" %}
    </a>
  </div>
  <div class="col-auto page-action">
    <a href="{{ target.get_absolute_url }}" class="btn btn-primary btn-sm">
      <span class="fas fa-external-link-alt"></span>
      {% trans "View on site" context "admin categories" %}
    </a>
  </div>
{% endif %}
{% endblock %}


{% block form-header %}
{% if target.pk %}
  {% trans "Edit category" context "admin category form" %}
{% else %}
  {% trans "New category" context "admin category form" %}
{% endif %}
{% endblock %}


{% block form-body %}
<div class="form-fieldset">
  <fieldset>
    <legend>{% trans "Display and position" context "admin category form" %}</legend>

    {% form_row form.new_parent %}
    {% form_row form.name %}
    {% form_row form.short_name %}
    {% form_row form.color %}
    {% form_row form.description %}
    {% form_row form.css_class %}

  </fieldset>
</div>
<div class="form-fieldset">
  <fieldset>
    <legend>{% trans "Behavior" context "admin category form" %}</legend>

    {% form_row form.copy_permissions %}
    {% form_row form.is_closed %}

  </fieldset>
</div>
<div class="form-fieldset">
  <fieldset>
    <legend>{% trans "Content approval" context "admin category form" %}</legend>

    {% form_row form.require_threads_approval %}
    {% form_row form.require_replies_approval %}
    {% form_row form.require_edits_approval %}

  </fieldset>
</div>
<div class="form-fieldset">
  <fieldset>
    <legend>{% trans "Prune threads" context "admin category form" %}</legend>

    {% form_row form.prune_started_after %}
    {% form_row form.prune_replied_after %}
    {% form_row form.archive_pruned_in %}

  </fieldset>
</div>
{% endblock form-body %}
