{% extends "admin/background_pages/base.html" %}

{% load bulb_static static compress humanize %}

{% block title %}Activity{% endblock title %}

{% block head %}
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

    {% if DEBUG %}
        {% if not BULB_REQUIRES_INITIAL_PATHS %}
            {% compress css %}
                <link rel="stylesheet" type="text/x-scss" href="{% static "activity/css/style/activity_page.scss" %}"/>
            {% endcompress %}

        {% else %}
            <link rel="stylesheet" type="text/x-scss" href="{% static "activity/css/style/activity_page.scss" %}"/>

        {% endif %}

    {% elif not DEBUG %}
        {% if BULB_BUNDLED_FILES_VERSION != None %}
            {% with url='activity/bundle_activity_page&V='|add:BULB_BUNDLED_FILES_VERSION|add:'.css' %}
                <link rel="stylesheet" href="{% static_bundled_src url %}"/>
            {% endwith %}

        {% else %}
            <link rel="stylesheet" href="{% static_bundled_src "activity/bundle_activity_page.css" %}"/>

        {% endif %}

    {% endif %}
{% endblock head %}

{% block administration_part_name %}
    <i class="material-icons">keyboard_arrow_right</i>

    <a class="nav-link" href="{% url "activity" %}">Activity</a>
{% endblock administration_part_name %}

{% block content %}
    <div id="activities">
        {% for activity in activities %}
            <div class="activity
                {% if activity.action == "create" %}
                     create">
                    <p>
                        <i class="material-icons i-create">add_circle_outline</i>

                {% elif activity.action == "edit" %}
                     edit">
                    <p>
                        <i class="material-icons i-edit">edit</i>

                {% elif activity.action == "delete" %}
                     delete">
                    <p>
                        <i class="material-icons i-delete">delete</i>

                {% endif %}
                    <span class="user">{{ activity.user }}</span>
                    <span
                    {% if activity.action == "create" %}
                        class="create-action">
                        create

                    {% elif activity.action == "edit" %}
                        class="edit-action">
                        edit

                    {% elif activity.action == "delete" %}
                        class="delete-action">
                        delete

                    {% endif %}
                    </span>

                    <span class="node_model"> {{ activity.node_model }}</span>

                    <span class="instance_uuid"> ({{ activity.instance_uuid }})</span>

                    <span class="datetime">{{ activity.datetime|naturaltime }}</span>
                    </p>
            </div>

        {% empty %}
            No administrator's activities (creation, edition or deletion) yet.
        {% endfor %}
    </div>
{% endblock content %}

{% block scripts %}{% endblock scripts %}
