{% extends 'layout.html' %}
{% import 'forms.html' as forms %}
{% from "box_macros.html" import box %}

{% block content %}
<h1>Builders: {{ branches|join(', ')|e }}</h1>

<table>
{% for b in builders %}
  <tr>
  <td class="box"><a href="{{ b.link }}">{{ b.name|e }}</a></td>
  {% if b.build_url %}
    <td class="LastBuild box {{ b.build_css_class }}">
        <a href="{{ b.build_url }}">{{ b.build_label }}</a>
        <br/>{{ b.build_text }}
    </td>
  {% else %}
    <td class="LastBuild box">no build</td>
  {% endif %}  
  {{ box(**b.current_box) }}  
  </tr>
{% endfor %}
</table>

{% if num_building > 0 %}
  {% if authz.advertiseAction('stopAllBuilds') or authz.advertiseAction('stopBuild') %}
    <h2>Stop Selected Builds</h2>
    {{ forms.stop_build(path_to_root+"builders/_selected/stopselected", authz, on_selected=True, builders=builders, label='Selected Builds') }}
    <h2>Stop All Builds</h2>
    {{ forms.stop_build(path_to_root+"builders/_all/stopall", authz, on_all=True, label='All Builds') }}
  {% endif %}
{% endif %}
  
{% if num_online > 0 %}
  {% if authz.advertiseAction('forceAllBuilds') or authz.advertiseAction('forceBuild') %}
    <h2>Force Selected Builds</h2>
    {{ forms.force_build(path_to_root+"builders/_selected/forceselected", authz, on_selected=True, builders=builders) }}
    <h2>Force All Builds</h2>
    {{ forms.force_build(path_to_root+"builders/_all/forceall", authz, on_all=True) }}
  {% endif %}
{% endif %}

{% endblock %}
