{% block cell-content %}
{% spaceless %}
{% if title %}<h2>{{ title }}</h2>{% endif %}
<div>
  {% include "combo/asset_picture_fragment.html" %}
  <form id="form-cell-choix-commune">
    <select id="select-cell-choix-commune" class="select-cell-choix-commune">
      <option value="">Sélectionnez</option>
      {% for link in links %}
        <option value="{{ link.url }}">{{ link.title }}</option>
      {% endfor %}
    </select>
  </form>
  <p class="description">
    Sélectionnez votre commune et découvrez ses services en ligne.
  </p>
</div>
{% endspaceless %}
{% endblock %}

<link rel="stylesheet" type="text/css" href="{{eservices_url}}static/js/select2/select2.css">
<script src="{{eservices_url}}static/js/select2/select2.js"></script>
<script>
  $(function() {
    $('#select-cell-choix-commune')
      .select2()
      .on('select2:select', function(e){
        var link = e.params.data.id;
        if (!link) {
          return;
        }
        window.location.href = link;
      });
  });
</script>
