<section class="col-md-8 dates-retenir">
    <h2 class="h2-home-theme">{{ rootTitle|raw }}</h2>
    <a class="voir-plus voir-plus-agenda-theme" href="{{ path('ez_urlalias', {'locationId': rootID }) }}"><span class="arrow">&gt;</span> tout l’agenda</a>

    <div id="slideDates" class="flexslider">
        <div class="flex-viewport">
            <ul class="slides">
                {% for locationId,event in eventsList %}
                    <li>
                        <div class="date">
                            <div class="date-wrapper">
                                {% if event.fields.date_debut is defined and not ez_is_field_empty( event, "date_debut" ) and event.fields.date_fin is defined and not ez_is_field_empty( event, "date_fin" ) %}
                                    <div class="small-date">
                                        <span>Du</span>
                                        <time datetime="{{ ez_field_value(event, "date_debut")|localizeddate('none', 'none', app.request.locale, null, "yyyy-MM-dd") }}">{{ ez_field_value(event, "date_debut")|localizeddate('none', 'none', app.request.locale, null, "dd MMM") }}</time>
                                    </div>
                                {% else %}
                                    <div>
                                        <span>Le</span>
                                        <time datetime="{{ ez_field_value(event, "date_debut")|localizeddate('none', 'none', app.request.locale, null, "yyyy-MM-dd") }}">{{ ez_field_value(event, "date_debut")|localizeddate('none', 'none', app.request.locale, null, "dd MMM") }}</time>
                                    </div>
                                {% endif %}
                                {% if event.fields.date_debut is defined and not ez_is_field_empty( event, "date_debut" ) and event.fields.date_fin is defined and not ez_is_field_empty( event, "date_fin" )%}
                                    <div class="small-date">
                                        <span>Au</span>
                                        <time datetime="{{ ez_field_value(event, "date_fin")|localizeddate('none', 'none', app.request.locale, null, "yyyy-MM-dd") }}">{{ ez_field_value(event, "date_fin")|localizeddate('none', 'none', app.request.locale, null, "dd MMM") }}</time>
                                    </div>
                                {% endif %}
                            </div>
                        </div>
                        {{ ez_render_field( event, "vignette", { 'template': 'AyalineEzAgendaCollectivitesBundle:fields:event_ezobjectrelation.html.twig', 'parameters': { 'alias': 'home_event_agenda' } } ) }}

                        <div class="caption">
                            {% set tags = [] %}
                            {% for tag in event.getFieldValue('thematiques').tags %}
                                {% set tags = tags|merge([tag.keyword]) %}
                            {% endfor %}
                            <h3>
                                {{ ez_render_field(event, 'thematiques') }}
                            </h3>
                            <p>{{ ez_render_field(event, 'titre') }}</p>
                        </div>
                        <a href="{{ path('ez_urlalias', {'locationId': locationId }) }}" class="lire-suite">lire la suite</a>

                    </li>
                {% endfor %}
            </ul>
        </div>

    </div>

</section>