{% extends "ressources/base.html" %}

{% block header %}
  {{ block.super }}
  <span>Gestion des ressources - {{ service_name }}</span>
{% endblock %}

{% block appbar %}
  <h2>{{ model_verbose_name_plural }}</h2>
  <a href="..">Retourner aux ressources</a>
  <button id="new-object-button" class='dialog-button' data-default-button="Ajouter" data-url="new/ #form-content">Ajouter « {{ model_verbose_name }} »</button>
{% endblock %}

{% block content %}
    {% if object_list %}
    <table id="ressource-list" class="main">
    <thead>
     <th class="col-id">Identifiant</th>
     <th class="col-label">Libellé</th>
     <th class="col-action"></th>
    </thead>
    <tbody>
     {% for object in object_list %}
     <tr id="ressource-{{ object.pk }}" {% if new_id == object.pk %}class="new-object"{% endif %}>
     <td class="col-id">{{object.pk}}</td>
     <td class="col-label"><a href="{{ object.pk }}">{{object}}</a></td>
     <td class="col-action"><button class="dialog-button delete-object-button"
               data-url="{{ object.pk }}/delete/ #form-content">Supprimer</button></td>
     </tr>
     {% endfor %}
    </tbody>
    </table>
    <script type="text/javascript">$('.new-object').effect('highlight', {}, 3000);</script>
    {% else %}
    <div class="big-msg-info">
    <p>
     Cliquez sur le bouton « Ajouter » en haut à droite pour ajouter un
     élément.
    </p>
    </div>
    {% endif %}
{% endblock %}
