{# 
Displays a select box for ordering search results

sort = The currently selected option

Example:

  {% snippet 'snippets/sort_by.html', sort=c.sort_by_selected %}

#}
<span class="form-select form-group control-order-by">
  <label for="field-order-by">{{ _('Order by') }}</label>
  <select id="field-order-by" name="sort" class="form-control">
    <option value="score desc, metadata_modified desc"{% if sort =='score desc, metadata_modified desc' %} selected="selected"{% endif %}>{{ _('Relevance') }}</option>
    <option value="title_string asc"{% if sort=='title_string asc' %} selected="selected"{% endif %}>{{ _('Name Ascending') }}</option>
    <option value="title_string desc"{% if sort=='title_string desc' %} selected="selected"{% endif %}>{{ _('Name Descending') }}</option>
    <option value="metadata_modified desc"{% if sort=='metadata_modified desc' %} selected="selected"{% endif %}>{{ _('Last Modified') }}</option>
    {% if g.tracking_enabled %}
      <option value="views_recent desc"{% if sort=='views_recent desc' %} selected="selected"{% endif %}>{{ _('Popular') }}</option>
    {% endif %}
  </select>
  <button class="btn btn-default js-hide" type="submit">{{ _('Go') }}</button>
</span>
