{% extends "MuzichCoreBundle::layout.html.twig" %}

{% block title %}{{ 'title.search'|trans({}, 'userui') }}{% endblock %}
{% block mainbox_classes %}mainbox_padding{% endblock %}

{% block main_content %}

  <div id="results_search_form">
    {% include "MuzichCoreBundle:GlobalSearch:form.html.twig" with {'form': form } %}
  </div>
  
  <div class="global_search_results">
    {% if results.users|length or results.groups|length or results.elements|length %}
    
      {% if results.users %}
  
        <b>{{ 'search.users'|trans({}, 'network') }}</b>
        
        <ul id="search_users" class="inline">
        {% for user in results.users %} 
          <li>
            <a href="{{ path('show_user', { 'slug': user.slug }) }}">{{ user.username }}</a>
          </li>
        {% endfor %}
        </ul>
  
      {% endif %}
    
      {% if results.groups %}
  
        <b>{{ 'search.groups'|trans({}, 'network') }}</b>
        
        <ul id="search_groups" class="inline">
        {% for group in results.groups %} 
          <li>
            <a href="{{ path('show_group', { 'slug': group.slug }) }}">{{ group.name }}</a>
          </li>
        {% endfor %}
        </ul>
  
      {% endif %}
    
      {% if results.elements %}
  
        <b>{{ 'search.elements'|trans({}, 'network') }}</b>
        
        {% include "MuzichCoreBundle:SearchElement:default.html.twig" with {
          'noelements_filter' : true,
          'elements'          : results.elements,
          'display_autoplay'     : true,
          'autoplay_context'     : 'home'
        }%}
        
        {% if display_more_button and results.elements|length %}
          {% include "MuzichCoreBundle:SearchElement:more_button.html.twig" with {
            'more_path'           : path('global_search_elements_empty')
          }%}
        {% endif %}
        
      {% endif %}
        
    {% elseif app.request.getMethod == 'POST' %}
        <p>
          {{ 'global_search.no_results'|trans({}, 'userui') }}
        </p>
    {% endif %}
  
  </div>
  
{% endblock %}