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


{% block page-actions %}
<div class="col-auto page-action">
  <a href="{% url 'misago:admin:permissions:categories:new' %}" class="btn btn-primary btn-sm">
    <span class="fa fa-plus-circle"></span>
    {% trans "New role" %}
  </a>
</div>
{% endblock %}


{% block table-header %}
<th>{% trans "Roles" %}</th>
<th style="width: 1px;">&nbsp;</th>
{% endblock table-header %}


{% block table-row %}
<td>
  <a href="{% url 'misago:admin:permissions:categories:edit' pk=item.pk %}" class="item-name small">
    {{ item }}
  </a>
</td>
<td>
  <div class="dropdown">
    <button class="btn btn-light btn-sm dropdown-toggle" type="button" id="item-optioms-{{ item.pk }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
      <i class="fas fa-ellipsis-h"></i>
    </button>
    <div class="dropdown-menu dropdown-menu-right" aria-labelledby="item-optioms-{{ item.pk }}">
      <a class="dropdown-item" href="{% url 'misago:admin:permissions:categories:edit' pk=item.pk %}">
        {% trans "Edit role" %}
      </a>
      <form action="{% url 'misago:admin:permissions:categories:delete' pk=item.pk %}" method="post" data-delete-confirmation="true">
        {% csrf_token %}
        <button class="dropdown-item">
          {% trans "Delete role" %}
        </button>
      </form>
    </div>
  </div>
</td>
{% endblock %}


{% block blankslate %}
<td colspan="2">
  {% trans "No category roles are set." %}
</td>
{% endblock blankslate %}


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