{% extends base_template %}
{% load staticfiles %}
{% load i18n %}

{% block headjs %}{{ block.super }}
<script type="text/javascript">
    window.ZONE_ID = "{{ zone_id }}";
    {% for id, device in devices.items %}
        {% if device.is_own_device %}
            window.DEVICE_ID = "{{ id }}";
        {% endif %}
    {% endfor %}
</script>
{% endblock headjs %}

{% block headcss %}{{ block.super }}
    <link rel="stylesheet" type="text/css" href="{% static 'css/control_panel/base.css' %}" />
    <!-- Override bootstrap here to fix up search bar -->
    <style type="text/css">
        .container {
            max-width: 1030px;
        }
        ul.pagination {
            margin: 0px;
        }
        ul.pagination > .active > a {
            color: #ffffff;
        }
    </style>
{% endblock headcss %}

{% block content %}

{% block subnavbar %}{{block.super}}{% endblock subnavbar %}

    {% block titlebar %}
        <ul class="titlebar__title">
        {% block titlebar_title %}
            {% comment "Draw the top navigation bar" %}{% endcomment %}
            {% if org %}
            <li><a href="{% url 'org_management' %}">{{ org.name }}</a></li>
            {% endif %}

            <li>
                {% if org %}/{% endif %}
                {% if facility or device %}<a href="{% url 'zone_management' zone_id=zone_id %}">{% endif %}
                    {% if is_headless_zone %}
                        {% trans "Local KA Lite Installation" %}
                    {% elif zone %}
                        {{ zone.name|truncatechars:35 }}
                    {% elif not zone %}
                        {% if is_central %}
                        {% trans "New Sharing Network" %}
                        {% else %}
                        Unregistered Device {{ device.name }} - <a class="not-registered-only" href="{% url 'register_public_key' %}">Register Now!</a>
                        {% endif %}
                    {% endif %}
                {% if facility or device %}</a>
                {% elif own_device_is_trusted %}
                <a class="edit-link" href="{% url 'zone_form' zone_id=zone_id %}">
                    <span class="glyphicon glyphicon-pencil" title="{% trans 'Edit' %}"></span>
                </a>
                {% endif %}
            </li>
            <li>

            {% if device %}
            <li>/ {% if device.name %}{{ device.name }}{% else %}{{ device.id }}{% endif %}</li>
            {% endif %}

            {% if facility %}
            <li>
                / {% if group_id %}<a href="{% url 'facility_management' zone_id=zone_id facility_id=facility_id %}">{{ facility.name }}</a>
                {% else %}
                {{ facility.name }}
                <a class="edit-link edit-facility" href="{% url 'facility_form' zone_id=zone_id facility_id=facility.id %}">
                <span class="glyphicon glyphicon-pencil" title="{% trans 'Edit' %}"></span>
              </a>
                {% endif %}
            </li>
            {% endif %}

            {% if group %}
            <li>{% if facility %}/ {% endif %}{{ group.name }}</li>

            {% endif %}
        {% endblock titlebar_title %}
            {% comment "Provide upload/download buttons; each button should be an LI" %}{% endcomment %}
            {% comment "Provide upload/download buttons; each button should be an LI" %}{% endcomment %}
            <ul class="pull-right">
            {% block buttons %}
            {% endblock buttons %}
            </ul>
        </ul>
    {% endblock titlebar %}

    {% block control_panel_content %}
    {% endblock control_panel_content %}
{% endblock content %}
