{% extends "release_dashboard/base.html" %}
{% load static %}
{% load rd_extras %}
{% block title %}Build release{% endblock %}
{% block navlist %}
    <li><a href="{% url 'release_dashboard:index'%}">Release Dashboard</a></li>
{% endblock %}
{% block content %}
<div class="container">
  <div class="panel panel-default">
      <div class="panel-heading">
          <h3 class="panel-title">Supported Releases</h3>
      </div>
      <div class="panel-body">
        {% regroup releases by base as releases_list %}
        <ul class="nav nav-pills" role="tablist">
        {% for base, data_list in releases_list %}
        {% if base != 'master' %}
          <li role="presentation">
            <a href="#{{base|replace_dots:'_'}}" aria-controls="{{base|replace_dots:'_'}}"
               role="tab" data-toggle="tab">{{base}}</a>
          </li>
        {% endif %}
        {% endfor %}
        </ul>
      <div class="tab-content col-md-8">
        {% for base, data_list in releases_list %}
        {% if base != 'master' %}
        <div role="tabpanel" class="tab-pane" id="{{base|replace_dots:'_'}}">
          <ul class="list-group row">
            {% for data in data_list %}
            <li class="list-group-item col-xs-2 {% if data.release in builds %}list-group-item-info{% endif %}">
              <a href="{% url 'release_dashboard:build_release' release=data.release %}">
                {{ data.release }}
              </a>
              {% if data.release == base %}<span class="label label-primary">mrX.X</span>{% endif %}
            </li>
            {% endfor %}
          </ul>
        </div>
        {% endif %}
        {% endfor %}
      </div>
      </div>
  </div>
  <div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">Master Releases</h3>
    </div>
    <div class="panel-body">
      {% for base, data_list in releases_list %}
      {% if base == 'master' %}
      <div class="btn-group btn-group-justified" role="group" aria-label="Justified button group">
        {% for data in data_list %}
        <a class="btn btn-default {% if data.release in builds %}btn-info{% endif %}" role="button" href="{% url 'release_dashboard:build_release' release=data.release %}">
          {{ data.release }}
        </a>
        {% endfor %}
      </div>
      {% endif %}
      {% endfor %}
    </div>
  </div>
</div>
{% endblock %}
