{% extends basetemplate %}

{% load i18n %}
{% load user_tags %}

{% block subtitle %}
    {% trans "Dashboard" %}
{% endblock %}
{% block description %}
    {% trans "Welcome to the OSQA administration area." %}
{% endblock %}

{% block admincontent %}
    <div class="module" style="width:49%; display: inline-block; vertical-align: top;">
        <table style="width: 100%; height: 100%;">
            <caption>{% trans "Quick statistics"  %}</caption>
            <tr>
                <td>
                {{ statistics.total_questions }} {% trans "question" %}{{ statistics.total_questions|pluralize }} ({{ statistics.questions_last_24 }} {% trans "in the last 24 hours" %})
                </td>
            </tr>
            <tr>
                <td>
                {{ statistics.total_answers }} {% trans "answer" %}{{ statistics.total_answers|pluralize }} ({{ statistics.answers_last_24 }} {% trans "in the last 24 hours" %})
                </td>
            </tr>
            <tr>
                <td>
                {{ statistics.total_users }} {% trans "user" %}{{ statistics.total_users|pluralize }} ({{ statistics.users_last_24 }} {% trans "joined in the last 24 hours" %})
                </td>
            </tr>
        </table>
    </div>
    <div class="module" style="width:49%; display: inline-block;">
        <table>
        <caption>{%trans "Site status" %}</caption>
            <tr>
                <td>
                    {% ifequal settings_pack "bootstrap" %}
                        {% trans "Your site is running in bootstrap mode, click the button below to revert to defaults." %}<br />
                    {% else %}
                        {% ifequal settings_pack "default" %}
                            {% trans "Your site is running in standard mode, click the button below to run in bootstrap mode." %}<br />
                        {% else %}
                            {% trans "Your site is running with some customized settings, click the buttons below to run with defaults or in bootstrap mode" %}
                        {% endifequal %}
                    {% endifequal %}
                    {% ifnotequal settings_pack "default" %}
                        <button onclick="if (window.confirm('{% trans "Are you sure you want to revert to the defaults?" %}')) window.location='{% url admin_go_defaults %}';">{% trans "revert to defaults" %}</button>
                    {% endifnotequal %}
                    {% ifnotequal settings_pack "bootstrap" %}
                        <button onclick="if (window.confirm('{% trans "Are you sure you want to run bootstrap mode?" %}')) window.location='{% url admin_go_bootstrap %}';">{% trans "go bootstrap" %}</button>
                    {% endifnotequal %}
                </td>
            </tr>
            <tr>
                <td>
                    <em>"Bootstrap mode" relaxes the minimum required reputation to perform actions like voting and commenting.
                    This is useful to help new communities get started.</em>
                </td>
            </tr>
        </table>
    </div>
    <div class="module" style="width:98%; display: inline-block;">
        <table width="100%">
        <caption>{% trans "Recent activity" %}</caption>
            <tr>
                <td colspan="2">
                    <table id="result_list" width="100%">
                    {% for activity in recent_activity.paginator.page %}
                        <tr class="{% cycle 'row1' 'row2' %}"><td>{% activity_item activity request.user %}</td></tr>
                    {% endfor %}
                    </table>
                </td>
            </tr>
        </table>
        <p class="paginator">
            {{ recent_activity.paginator.page_numbers }}
        </p>
    </div>
{% endblock %}