{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "base.html" %}
{% set title = _('Media Gallery Search') %}
{% set styles= ('gallery',) %}
{% set scripts = ('wiki',) %}
{% set crumbs = [(url('gallery.gallery', media_type), _('Media Gallery')),
                 (None, _('Search'))] %}

{% block content %}
  <article id="gallery-list" class="main">
    <h1>{{ _('Media Gallery') }}</h1>
    <div id="locale-filter">
      <form action="" method="get">
        <label for="select-locale">{{ _('Show media for:') }}</label>
        <select id="select-locale" name="lang" class="autosubmit">
          {% for lang in settings.LANGUAGE_CHOICES %}
            <option value="{{ lang[0] }}" {% if lang[0] == request.locale %}selected="selected"{% endif %}>{{ lang[1] }} ({{ lang[0] }})</option>
          {% endfor %}
        </select>
        <noscript>
          <input type="submit" value="{{ _('Go') }}">
        </noscript>
      </form>
    </div>
    <div id="search-filter">
      <div id="media-type-filter">
        <span>{{ _("Show:") }}</span>
        <ol>
        <li>
          {% if media_type == 'image' %}
            <span>{{ _('Images') }}</span>
          {% else %}
            <a href="{{ url('gallery.search', 'image')|urlparams(q=q) }}">{{ _('Images') }}</a>
          {% endif %}
        </li>
        <li>
          {% if media_type == 'video' %}
            <span>{{ _('Videos') }}</span>
          {% else %}
            <a href="{{ url('gallery.search', 'video')|urlparams(q=q) }}">{{ _('Videos') }}</a>
          {% endif %}
        </li>
        </ol>
      </div>
      <div id="gallery-search">
        <form action="{{ url('gallery.search', media_type) }}" method="get">
          <input type="text" name="q" value="{{ q }}" required="required" />
          <input type="submit" value="{{ _('Search Gallery') }}">
        </form>
      </div>
    </div>
    {% with media_list=media %}
      {% include 'gallery/includes/media_list.html' %}
    {% endwith %}
  </article>
{% endblock %}
