{% load i18n %}
{% csrf_token %}

{% if form.non_field_errors %}
    <div class="error">
        {{ form.non_field_errors }}
    </div>
{% endif %}

{% for hidden in form.hidden_fields %}
    {{ hidden }}
{% endfor %}

{% for field in form.visible_fields %}
    <div class="row{% if field.errors %} error{% endif %}" id="{{ field.auto_id}}_controls">
      <div class="large-8 columns">
        {{ field.label_tag }}
        <span class="help-inline">{{ field.help_text }}</span>
        {{ field }}
      {% if field.errors %}
        <span class="help-inline error">{% for error in field.errors %}{{ error }}{% endfor %}</span>
      {% endif %}
      {% if field.name == 'audio' %}
        <div class="progress-result">
          {% if form.audio_filename.value %}
            Uploaded: {{ form.audio_filename.value }}
          {% endif %}
        </div>
        <div class="progress">
            <div class="bar" style="width: 0%;"></div>
        </div>
      {% endif %}
      </div>
    </div>
{% endfor %}

{% if submit %}
<div class="form-actions">
    {% if pre_submit_name %}
    <input type="submit" name="{{ pre_submit_name }}" id="id_{{ pre_submit_name }}" class="button" value="{{ pre_submit_text }}">
    {% endif %}
    <input type="submit" id="{{ type }}_submit" class="button" value="{{ submit }}">
    {% if post_submit_name %}
    <input type="submit" name="{{ post_submit_name }}" id="id_{{ post_submit_name }}" class="button" value="{{ post_submit_text }}">
    {% endif %}
</div>
{% endif %}
