{% if display_new_elements is not defined %}
  {% set display_new_elements = false %}
{% endif %}
{% if display_autoplay is not defined %}
  {% set display_autoplay = false %}
{% endif %}
{% if autoplay_context is not defined %}
  {% set autoplay_context = '' %}
{% endif %}

{% if display_new_elements %}
  <div class="display_more_elements" style="display: none;">
    <span></span>
  </div>
{% endif %}

{% if not app.request.isXmlHttpRequest %}
  <div class="elements_loader_div">
    <img class="elements_new_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading" />
  </div>
{% endif %}

{% if elements|length %}
  {% if not app.request.isXmlHttpRequest %}<ul class="elements" data-autoplay_context="{{ autoplay_context }}">{% endif %}
    {% for element in elements %} 
      
      {% include "MuzichCoreBundle:SearchElement:li.element.html.twig" %}
      
    {% endfor %} 
  {% if not app.request.isXmlHttpRequest %}</ul>{% endif %}

{% else %}

  <ul class="elements"></ul>

  <div class="no_elements">
    {% if noelements_filter is defined %}
      <p class="no-elements">
        {% autoescape false %}
          {{ 'noelements.sentence_filter'|trans({
            '%link_string%': 'noelements.sentence_filter_link_string'|trans({}, 'elements')
          }, 'elements') }}
        {% endautoescape %}
      </p>
    {% else %}
      <p class="no-elements">{{ 'noelements.sentence'|trans({}, 'elements') }}</p>
    {% endif %}
  </div>

{% endif %}

{% if not app.request.isXmlHttpRequest %}
  <div class="elements_loader_div">
    <img class="elements_more_loader" style="display: none;" src="{{ asset('/bundles/muzichcore/img/ajax-loader.gif') }}" alt="loading" />
  </div>
{% endif %}