{% extends 'layout.html.twig' %}

{% block content %}
    <section class="row-fluid">
        <div class="span2 sidebar">
            {% set namespace = project.namespace %}
            {{ block('sidebarNamespaces') }}
        </div>
    </section>
    <section class="row-fluid">
        <div class="span10 offset2">
            <div class="row-fluid">
                <div class="span8 content namespace">
                    <nav>
                        {#<a href="" class="pull-left">&laquo; NamespaceAssembler</a>#}
                        {{ node.parent|route|raw }}
                        {#<a href="" class="pull-right">ClassAssembler &raquo;</a>#}
                    </nav>
                    <h1><small>{{ node.parent.fullyQualifiedStructuralElementName }}</small>{{ node.name }}</h1>

                    {% if node.children|length > 0 %}
                    <h2>Namespaces</h2>
                    <table class="table table-hover">
                        {% for namespace in node.children|sort_asc %}
                            <tr>
                                <td>{{ namespace|route('class:short')|raw }}</td>
                            </tr>
                        {% endfor %}
                    </table>
                    {% endif %}

                    {% if node.traits|length > 0 %}
                    <h2>Traits</h2>
                    <table class="table table-hover">
                        {% for trait in node.traits|sort_asc %}
                            <tr>
                                <td>{{ trait|route('class:short')|raw }}</td>
                                <td><em>{{ trait.summary }}</em></td>
                            </tr>
                        {% endfor %}
                    </table>
                    {% endif %}

                    {% if node.interfaces|length > 0 %}
                    <h2>Interfaces</h2>
                    <table class="table table-hover">
                        {% for interface in node.interfaces|sort_asc %}
                            <tr>
                                <td>{{ interface|route('class:short')|raw }}</td>
                                <td><em>{{ interface.summary }}</em></td>
                            </tr>
                        {% endfor %}
                    </table>
                    {% endif %}

                    {% if node.classes|length > 0 %}
                    <h2>Classes</h2>
                    <table class="table table-hover">
                    {% for class in node.classes|sort_asc %}
                        <tr>
                            <td>{{ class|route('class:short')|raw }}</td>
                            <td><em>{{ class.summary }}</em></td>
                        </tr>
                    {% endfor %}
                    </table>
                    {% endif %}
                </div>

                <aside class="span4 detailsbar">
                    <dl>
                        <dt>Namespace hierarchy</dt>
                        <dd class="hierarchy">
                            {% set namespace = node.parent %}
                            {% block hierarchy_element %}
                                {% if namespace %}
                                    {% set child = namespace %}
                                    {% set namespace = namespace.parent %}
                                    {{ block('hierarchy_element') }}
                                    <div class="namespace-wrapper">{{ child|route|raw }}</div>
                                {% endif %}
                            {% endblock %}
                            <div class="namespace-wrapper">{{ node.fullyQualifiedStructuralElementName}}</div>
                        </dd>
                    </dl>
                </aside>
            </div>

            {% if node.constants|length > 0 %}
            <div class="row-fluid">
                <section class="span8 content namespace">
                    <h2>Constants</h2>
                </section>
                <aside class="span4 detailsbar"></aside>
            </div>

                {% for constant in node.constants|sort_asc %}
                    {{ block('constant') }}
                {% endfor %}
            {% endif %}

            {% if node.functions|length > 0 %}
            <div class="row-fluid">
                <section class="span8 content namespace">
                    <h2>Functions</h2>
                </section>
                <aside class="span4 detailsbar"></aside>
            </div>

                {% for method in node.functions|sort_asc %}
                    {{ block('method') }}
                {% endfor %}
            {% endif %}

        </div>
    </section>
{% endblock %}
