{% extends "wagtailadmin/base.html" %}
{% load i18n feature_flags flags_debug wagtailflags_admin %}

{% block titletag %}{% trans "Flags" %}{% endblock %}

{% block content %}
    {% trans "Flags" as flags_str %}
    {% trans "Add a flag" as add_a_flag_str %}

    {% include "wagtailflags/includes/header.html" with title=flags_str icon="tag" %}

    <div class="nice-padding">
        {% if flags|length == 0 %}
        <p>No flags have been defined.</p>
        {% else %}
            {% flag_enabled 'WAGTAILFLAGS_ADMIN_BIG_LIST' as big_list_flag %}

            {% if big_list_flag %}
                {% for flag in flags %}
                    <h2>{{ flag.name }}</h2>
                    {% include "wagtailflags/includes/flag_index.html" with flag=flag %}
                {% endfor %}
            {% else %}
                <table class="listing">
                    <thead>
                        <tr>
                            <th>Name</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                    {% for flag in flags %}
                        <tr>
                            <td>
                                <b><a href="{% url 'wagtailflags:flag_index' flag.name %}">{{ flag.name }}</a></b>
                            </td>
                            <td>
                                {{ flag|state_str }}
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
            {% endif %}

        {% endif %}

    </div>
{% endblock %}
