{% extends "telemeta/resource_detail.html" %}
{% load i18n %}
{% load telemeta_tags %}
{% load bootstrap3 %}

{% block title %}
<img src="{{ STATIC_URL }}telemeta/images/{{ type }}.png" style="vertical-align:middle" /> {{ type }} : {{ resource }}
{% endblock %}

{% block title_buttons %}
<div class="fixedWidthAsPlayer">
    <img id="wait-img" style="display:none" style="vertical-align:middle" alt="wait" src="{{ STATIC_URL }}telemeta/images/wait.gif" />
    {% block cancel %}
    <a id="cancel" href="{% url "telemeta-resource-detail" type resource.public_id %}">
      <button type="button" class="btn btn-default">
        <span class="glyphicon glyphicon-remove"></span> {% trans "Cancel" %}
      </button>
    </a>
    {% endblock %}
    <!--
    {% if perms.telemeta.change_mediaresource %}
    <a id="save" href="#" onclick="var d=document; d.getElementById('wait-img').style.display='inline'; $('#_editForm').submit();">
      <button type="button" class="btn btn-default">
        <span class="glyphicon glyphicon-floppy-disk"></span> {% trans "Save" %}
      </button>
    </a>
    {% endif %}
    -->
</div>
{% endblock %}

{% block infos %}

  <div>
  <form id="_editForm" method="post" action="" enctype="multipart/form-data">{% csrf_token %}

    <ul class="nav nav-tabs" role="tablist">
      <li class="active"><a href="#general" role="tab" data-toggle="tab">{% trans "General" %}</a></li>
      <li><a href="#related" role="tab" data-toggle="tab">{% trans "Related media" %}</a></li>
    </ul>

    <div class="tab-content">

      <div class="tab-pane fade in active" id="general">
        <script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
        <script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
        <script type="text/javascript" src="/static/admin/js/actions.min.js"></script>
        {{ form.media }}
        <div class="block-grey">
        {% bootstrap_form form %}
        </div>
      </div>

      <div class="tab-pane" id="related">
        {% for formset in inlines %}
          {{ formset.management_form }}
          {% for form in formset %}
           <div class="block-grey">
           {% bootstrap_form form %}
           </div>
          {# {{ form.as_table }} #}
          {% endfor %}
        {% endfor %}
      </div>

    </div>

    <div align="center" style="margin-top:3ex;">
     {% block cancel2 %}
     <a id="cancel" href="{% url "telemeta-resource-detail" type resource.public_id %}">
      <button type="button" class="btn btn-default">
        <span class="glyphicon glyphicon-remove"></span> {% trans "Cancel" %}
      </button>
     </a>
     {% endblock %}
     {% if perms.telemeta.change_mediacorpus or perms.telemeta.change_mediafonds %}
     <input type="submit" value="{% trans "Save" %}" class="default" name="_save"/>
     <!--
     <a id="save" href="#" onclick="var d=document; d.getElementById('wait-img').style.display='inline'; $('#_editForm').submit();">
      <button type="submit" class="btn btn-default" name="_save">
        <span class="glyphicon glyphicon-floppy-disk"></span> {% trans "Save" %}
      </button>
     </a>
     -->
     {% endif %}
    </div>

   </form>
  </div>

{% endblock infos %}

{% block dublincore %}
{% endblock dublincore %}

{% block delete %}
{% endblock %}
