{% import 'macros/wtf.html' as wtf %}

{% macro batch_head_row(id) -%}
<th><input id="{{id}}" type="checkbox" onclick="checkAll();" /></th>
{%- endmacro %}

{% macro batch_body_row(class, value) -%}
<td><input type="checkbox" name="ids[]" value="{{ value }}" class="{{ class }}" /></td>
{%- endmacro %}

{% macro batch_script(id, class) -%}
<script type="text/javascript">
/* <![CDATA[ */
function checkAll()
{
	var boxes = document.getElementsByTagName('input'); for(var index = 0; index < boxes.length; index++) { box = boxes[index]; if (box.type == 'checkbox' && box.className == '{{ class }}') box.checked = document.getElementById('{{ id }}').checked } return true;
}
/* ]]> */
</script>
{%- endmacro %}

{% macro batch_buttons(form) -%}
{{ wtf.inline_field(form.batch_action) }}
{{ form.hidden_tag() if form.hidden_tag }}
<input class="btn" type="submit" value="{{ gettext('Run') }}" />
{%- endmacro %}