{% extends "admin/base_site.html" %}
{% load i18n humanize_time %}

{% block content %}
{{ form.errors }}
{% for feature_flag in feature_flags %}
    {% with anchor=feature_flag.human_name|slugify %}
    <h2 id="{{ anchor }}">{{ feature_flag.human_name }} - {{ feature_flag.state.name }}&nbsp;<a href="#{{ anchor }}">&para;</a></h2>
    {% endwith %}
    <pre>{{ feature_flag.description }}</pre>
    <p>(Initial default state: {{ feature_flag.initial_state.name }})</p>
    <p>Current state: <strong>{{ feature_flag.state.name }}</strong></p>
    {% if feature_flag.last_change %}
        <p>
            {% blocktranslate with time=feature_flag.last_change.action_time|human_duration user=feature_flag.last_change.user %}
                Last changed by {{ user }} {{ time }} ago.
            {% endblocktranslate %}
        </p>
    {% endif %}
    <form method="post">
        {% csrf_token %}
        <input type="hidden" name="cache_key" value="{{ feature_flag.cache_key }}">
        <input type="hidden" name="new_value" value="{{ feature_flag.opposite_state.value }}">
        <input type="submit" value="Set '{{ feature_flag.human_name }}' to {{ feature_flag.opposite_state.name }}">
    </form>
{% endfor %}
{% endblock %}
