{% extends "ui/base-devices.html" %}

{% load url from future %}
{% load icons %}

{% block sidebar %}
<div class="well">
    <ul class="unstyled">
    {% for d in devices %}
        <li>{{ d|device_icon }}&nbsp;{{ d }}</li>
    {% endfor %}
    </ul>
</div>
{% endblock %}

{% block contentarea %}
<form class="form form-horizontal bulk-edit-form" method="POST">
    {% csrf_token %}
    {% for d in devices %}
    <input type="hidden" name="select" value="{{ d.id }}">
    {% endfor %}
    {% for f in form.visible_fields %}
    {% if f.name != 'save_comment' %}
    <div class="control-group {{ f.css_classes }}
        {% if f.errors %}error{% endif %}
        {% if f.name in different_fields %}warning{% endif %}
    ">
        <label class="control-label">
            {{ f|field_icon:form }}
            {{ f.label }}
        </label>
        <div class="controls">
            <div class="input-prepend">
                <span class="add-on">
                    <input
                        type="checkbox" 
                        name="edit" 
                        value="{{ f.name }}"
                        style="margin-top: -2px"
                        {% if f.name in edit_fields %}
                        checked='checked'
                        {% endif %}
                    >
                </span>{{ f }}
                {% for e in f.errors %}
                    <span class="help-inline">{{ e }}</span>
                {% empty %}
                {%  if f.help_text %}
                    <span class="help-inline">{{ f.help_text }}</span>
                {%  endif %}
                {% endfor %}
            </div>
        </div>
    </div>
    {% endif %}
    {% endfor %}
<div class="form-actions">
<div 
    class="input-append control-group {% if form.save_comment.errors %}error{% endif %}"
    style="white-space:nowrap">
    {{ form.save_comment }}<button
        class="btn btn-primary"
        type="submit"
        name="save">
            {% icon 'fugue-tick' %}&nbsp;Save
    </button>
    {% for e in form.save_comment.errors %}
        <div class="help-block error-text">{{ e }}</div>
    {% empty %}
        <div class="help-block">{{ form.save_comment.help_text }}</div>
    {% endfor %}
</div>
</div>
</form>
{% endblock %}
