{% extends "base_generic.html" %}

{% block title %}{{ title }}{% endblock %}

{% block heading %}{{ heading }}{% endblock %}

{% block content %}

<div class="row">
  <div class="large-12 columns">
    <form method="POST" action="#" enctype="multipart/form-data">
      {% csrf_token %}
      <!-- Hidden button is default when ENTER key is pressed -->
      <!-- see http://stackoverflow.com/questions/1963245/    -->
      <input type="submit" name="save" value="Save" style="display:none;" />

      <div class="row">
        {% for field in fields %}
        {% include field.field_render_label_edit %}
        {% endfor %}
      </div>

      <div class="row">
        <div class="medium-2 columns show-for-medium-up">
          <div class="row">
            <div class="small-12 columns">
              &nbsp;
            </div>
          </div>
        </div>
        <div class="small-12 medium-4 columns">
          <div class="row">
            <div class="form-buttons small-12 columns">
              <input type="submit" name="save"          value="Save"   
                     title="Save values and return to previous view."/>
              <input type="submit" name="view"          value="View"
                     title="Save values and switch to entity view."/>
              <input type="submit" name="cancel"        value="Cancel"
                     title="Discard unsaved changes and return to previous view."/>
            </div>
          </div>
        </div>
        <div class="small-12 medium-6 columns">
          <div class="row">
            <div class="form-buttons small-12 columns medium-up-text-right">
              {% for b in edit_task_buttons %}
              <input type="submit" name="{{b.button_name}}" value="{{b.button_label}}" 
                     title="{{b.button_help}}"/>
              {% endfor %}
              {% if edit_view_button and edit_view_button != "no" %}
              <input type="submit" name="open_view" value="Edit view"
                     title="Edit definition for this entity view."
                     {{edit_view_enable}} />
              {% endif %}
              <input type="submit" name="customize" value="Customize"
                     title="Open 'Customize' view for collection '{{coll_id}}'."
                     {{customize_view_enable}} />
            </div>
          </div>
        </div>
      </div>

      <div class="row">
 
        {% with field=view_choices %}
        {% include field.field_render_label_edit %}
        {% endwith %}

        {% comment "New type/view/field/group buttons suppressed for now" %}
        {% if auth_config %}
        <div class="small-12 medium-6 columns medium-text-right">
          <div class="row">
            <div class="small-12 columns">
              <input type="submit" name="new_type"      value="New type" />
              <input type="submit" name="new_view"      value="New view" />
              <input type="submit" name="new_field"     value="New field type" />
              <input type="submit" name="new_group"     value="New field group" />
            </div>
          </div>
        </div>
        {% endif %}
        {% endcomment %}  

      </div>
  
      <input type="hidden" name="orig_id"          value="{{orig_id}}" />
      <input type="hidden" name="orig_type"        value="{{orig_type}}" />
      <input type="hidden" name="action"           value="{{action}}" />
      <input type="hidden" name="view_id"          value="{{view_id}}" />
      <input type="hidden" name="continuation_url" value="{{continuation_url}}" />
    </form>
  </div>
</div>

{% endblock %}
