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

{% block title %}
    {{ project.title }} &raquo; Compilation errors
{% 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 errorCount = 0 %}
                {% for file in project.files %}
                    {% if file.allerrors.count > 0 %}
                        <li><a href="#{{ file.path }}"><i class="icon-file"></i> {{ file.path }}</a></li>
                    {% endif %}
                    {% set errorCount = errorCount + file.allerrors.count %}
                {% endfor %}
            </ul>
        </div>

        <div class="span10 offset2">
            <ul class="breadcrumb">
                <li><a href="{{ path('/') }}"><i class="icon-remove-sign"></i></a><span class="divider">\</span></li>
                <li>Compilation Errors</li>
            </ul>

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

            {% for file in project.files %}
                <div class="package-contents">
                    {% if file.allerrors.count > 0 %}
                        <a name="{{ file.path }}" id="{{ file.path }}"></a>
                        <h3>
                            <i class="icon-file"></i>
                            {{ file.path }}
                            <small style="float: right;padding-right: 10px;">{{ file.allerrors.count }}</small>
                        </h3>
                        <div>
                            <table class="table markers table-bordered">
                                <thead>
                                <tr>
                                    <th>Type</th>
                                    <th>Line</th>
                                    <th>Description</th>
                                </tr>
                                </thead>
                                <tbody>
                                {% for error in file.allerrors %}
                                    <tr>
                                        <td>{{ error.severity }}</td>
                                        <td>{{ error.line }}</td>
                                        <td>{{ error.code|trans(error.context) }}</td>
                                    </tr>
                                {% endfor %}
                            </tbody>
                            </table>
                        </div>
                    {% endif %}
                </div>
            {% endfor %}
        </div>
    </section>
{% endblock %}
