{% extends "zumanji/layout.html" %}

{% load zumanji_helpers %}

{% block content %}
  <ul class="pager">
    {% if previous_build %}
      <li class="previous">
        {% if tag %}
          <a href="{% url zumanji:view_build project_label=previous_build.project.label tag_id=tag.id build_id=previous_build.id %}">&larr; Previous Build (#{{ previous_build.id }})</a>
        {% else %}
          <a href="{% url zumanji:view_build project_label=previous_build.project.label build_id=previous_build.id %}">&larr; Previous Build (#{{ previous_build.id }})</a>
        {% endif %}
      </li>
    {% else %}
      <li class="previous disabled">
        <a href="#">&larr; Previous Build</a>
      </li>
    {% endif %}

    {% if next_build %}
      <li class="next">
        {% if tag %}
          <a href="{% url zumanji:view_build project_label=next_build.project.label tag_id=tag.id build_id=next_build.id %}">Next Build (#{{ next_build.id }}) &rarr;</a>
        {% else %}
          <a href="{% url zumanji:view_build project_label=next_build.project.label build_id=next_build.id %}">Next Build (#{{ next_build.id }}) &rarr;</a>
        {% endif %}
      </li>
    {% else %}
      <li class="next disabled">
        <a href="#">Next Build &rarr;</a>
      </li>
    {% endif %}
  </ul>

  <h3>Build Details</h3>
  {% include "zumanji/includes/build_details.html" %}

  {% if changes %}
    <h3>Changes since <a href="{% url zumanji:view_build project_label=compare_build.project.label build_id=compare_build.id %}">#{{ compare_build.id }}</a></h3>
    <table class="table table-bordered table-striped">
      <thead>
        <tr>
          <th>Test</th>
          {% render_test_columns %}
        </tr>
      </thead>
      <tbody>
        {% for change in changes %}
          {% render_change_row change compare_build %}
        {% endfor %}
      </tbody>
    </table>
  {% endif %}

  <h3>Test Results</h3>
  <table class="table table-striped table-bordered">
    <thead>
      <tr>
        <th>Test</th>
        {% render_test_columns %}
        <th style="width:60px; text-align:center;">Duration</th>
      </tr>
    </thead>
    <tbody>
      {% for test in test_list %}
        {% render_test_row test %}
      {% endfor %}
    </tbody>
  </table>
{% endblock %}