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

{% block title %}
    {{ project.title }} &raquo; Markers
{% endblock %}

{% block content %}
    <section class="row-fluid">
        <div class="span2 sidebar">
            <ul class="side-nav nav nav-list">
                <li class="nav-header">Navigation</li>
                {% set markerCount = 0 %}
                {% for file in project.files %}
                    {% if file.markers.count > 0 %}
                    <li><a href="#{{ file.path }}"><i class="icon-file"></i> {{ file.path }}</a></li>
                    {% endif %}
                    {% set markerCount = markerCount + file.markers.count %}
                {% endfor %}
            </ul>
        </div>

        <div class="span10 offset2">

            <ul class="breadcrumb">
                <li><a href="{{ path('/') }}"><i class="icon-map-marker"></i></a><span class="divider">\</span></li>
                <li>Markers</li>
            </ul>

            {% if markerCount <= 0 %}
                <div class="alert alert-info">No markers have been found in this project.</div>
            {% endif %}

            <div id="marker-accordion">
                {% for file in project.files %}
                    {% if file.markers.count > 0 %}
                        <div class="package-contents">
                            <a name="{{ file.path }}" id="{{ file.path }}"></a>
                            <h3>
                            <i class="icon-file"></i>
                                {{ file.path }}
                                <small style="float: right;padding-right: 10px;">{{ file.markers.count }}</small>
                            </h3>
                            <div>
                                <table class="table markers table-bordered">
                                    <tr>
                                        <th>Type</th>
                                        <th>Line</th>
                                        <th>Description</th>
                                    </tr>
                                    {% for marker in file.markers %}
                                        <tr>
                                            <td>{{ marker.type }}</td>
                                            <td>{{ marker.line }}</td>
                                            <td>{{ marker.message }}</td>
                                        </tr>
                                    {% endfor %}
                                </table>
                            </div>
                        </div>
                    {% endif %}
                {% endfor %}
            </div>
        </div>
    </section>
{% endblock %}
