{% load django_tables2 %}
{% load i18n %}
<div class="btn-toolbar">
    <div class="dropdown">
        <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            {% trans "Actions" %}
        </button>
        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
            <a class="dropdown-item" href="{% url 'dashboard:catalogue-category-update' pk=record.id %}">
                {% trans "Edit category" %}
            </a>
            <a class="dropdown-item" href="{% url 'dashboard:catalogue-category-create-child' parent=record.pk %}">
                {% trans "Add child category" %}
            </a>
            <a class="dropdown-item {% if not record.has_children %}disabled{% endif %}"
               href="{% if not record.has_children %}#{% else %}{% url 'dashboard:catalogue-category-detail-list' pk=record.pk %}{% endif %}">
                {% trans "Edit children" %}
            </a>
            <a class="dropdown-item" href="{{ record.get_absolute_url }}">
                {% trans "View on site" %}
            </a>
            <a class="dropdown-item" href="{% url 'dashboard:catalogue-category-delete' pk=record.id %}">
                {% trans "Delete" %}
            </a>
        </div>
    </div>
</div>
