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


{% block title %}
{% blocktrans trimmed with category=target %}
  {{ category }}: Permissions
{% endblocktrans %} | {{ block.super }}
{% endblock title %}


{% block page-header %}
{{ block.super }}
<small>
  {{ category }}
</small>
{% endblock page-header %}


{% block page-actions %}
<div class="col-auto page-action">
  <a href="{% url 'misago:admin:categories:edit' pk=target.pk %}" class="btn btn-primary btn-sm">
    <span class="fa fa-edit"></span>
    {% trans "Edit category" %}
  </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" %}
  </a>
</div>
{% endblock %}


{% block form-header %}
{% trans "Change permissions" %}
{% endblock form-header %}


{% block form-body %}
  {% for form in forms %}
    <div class="form-group row">
      <label for="{{ form.category_role.id_for_label }}" class="col-sm-4 col-form-label">
        {{ form.role }}:
      </label>
      <div class="col-sm-8">
        {% form_input form.category_role %}
      </div>
    </div>
  {% endfor %}
{% endblock form-body %}


{% block javascripts %}
<script type="text/javascript">
  window.misago.initConfirmation(
    "[data-cancel-confirmation]",
    "{% trans 'Are you sure you want to abandon changes?' %}"
  )
</script>
{% endblock %}
