{% extends 'site/base.html' %}
{% load i18n %}
{% load compress %}
{% load static %}

{% block title %}{% trans 'c3nav control panel' %}{% endblock %}
{% block header_title %}<span id="subheader">{% trans 'control panel' %}</span>{% endblock %}
{% block header_title_url %}{% url 'control.index' %}{% endblock %}

{% block content %}
<main class="control"{% block addattributes %}{% endblock %}>
    {% include 'site/fragment_messages.html' %}
    {% block back_link %}{% if not request.mobileclient %}<a href="{% url 'site.index' %}" class="float-right">&laquo; {% trans 'back to c3nav' %}</a>{% endif %}{% endblock %}
    <h2>{% block heading %}{% endblock %}</h2>
    {% block menu %}
    <nav>
        <p>
            <a href="{% url 'control.index' %}">{% trans 'Overview' %}</a> &middot;
            {% if request.user_permissions.view_users %}
                <a href="{% url 'control.users' %}">{% trans 'Users' %}</a> &middot;
            {% endif %}
            <a href="{% url 'control.access' %}">{% trans 'Access' %}</a> &middot;
            {% if request.user_permissions.manage_announcements %}
                <a href="{% url 'control.announcements' %}">{% trans 'Announcements' %}</a> &middot;
            {% endif %}
            {% if request.user_permissions.manage_map_updates %}
                <a href="{% url 'control.map_updates' %}">{% trans 'Map Updates' %}</a> &middot;
            {% endif %}
            {% if request.user_permissions.can_manage_mesh %}
                <a href="{% url 'mesh.nodes' %}">{% trans 'Mesh' %}</a> &middot;
            {% endif %}
            <a href="{% url 'control.users.detail' user=request.user.pk %}">{{ request.user.username }}</a>
        </p>
    </nav>
    <hr>
    {% endblock %}
    {% block subcontent %}
    {% endblock %}
</main>
    {% include 'site/fragment_fakemobileclient.html' %}
    {% compress js %}
        <script type="text/javascript" src="{% static 'jquery/jquery.js' %}"></script>
        <script type="text/javascript">
        if (window.mobileclient) {
            var $body = $('body');
            if ($body.is('[data-user-data]')) {
                mobileclient.setUserData($body.attr('data-user-data'));
            }
        }
        </script>
    {% endcompress %}
{% endblock %}
