{% extends "rest_framework/base.html" %}

{% load rest_framework %}
{% load static %}


{% block breadcrumbs %}
    <link rel="stylesheet" type="text/css" href="{% static "dynamic_rest/css/default.css" %}"/>
    <ul class="breadcrumb">
        {% for breadcrumb_name, breadcrumb_url in breadcrumblist %}
            {% if forloop.last %}
                <li class="active"><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
            {% else %}
                <li><a href="{{ breadcrumb_url }}">{{ breadcrumb_name }}</a></li>
            {% endif %}
        {% endfor %}
    </ul>
    {# the directory is shoehorned into the breadcrumbs block because there is no other block to fit it into #}
    {% block directory %}
        <div class="directory">
            {% if breadcrumblist %}
            <li><a href="{{ breadcrumblist.0.1 }}">{{ breadcrumblist.0.1 }}</a>
            {% else %}
            <li><a href="/">/</a>
            {% endif %}
            <ul>
                {% for l1_name, l1_link, l1_items, l1_active in directory %}
                    <li>
                        {% if l1_link %}
                            <a {% if l1_active %}class="active"{% endif %} href="{{l1_link}}">{{l1_name}}/</a>
                        {% else %}
                            {{l1_name}}/
                        {% endif %}
                        <ul>
                            {% for l2_name, l2_link, l2_items, l2_active in l1_items %}
                                <li>
                                    {% if l2_link %}
                                        <a {% if l2_active %}class="active"{% endif %} href="{{l2_link}}">{{l2_name}}/</a>
                                    {% else %}
                                        {{l2_name}}/
                                    {% endif %}
                                </li>
                            {% endfor %}
                        </ul>
                    </li>
                {% endfor %}
            </ul>
            </li>
        </div>
    {% endblock %}
{% endblock %}
