<%# locals: () %>

<div id="user-list-option-groups" class="list-option-groups">

  <%= form_tag(users_path, class: 'sidebar-search', method: :get) do %>
    <% if params[:sort].present? %>
      <input type="hidden" name="sort" value="<%= params[:sort] %>">
    <% end %>
    <% if params[:banned].present? %>
      <input type="hidden" name="banned" value="<%= params[:banned] %>">
    <% end %>
    <input id="user-search-field" type="search" name="q" value="<%= params[:q] %>" placeholder="<%= t('users.search_placeholder') %>"><input class="search-submit" type="submit" value="🔎">
  <% end %>

  <div id="user-list-sort" class="list-option-group"><%= t('scripts.listing_sort_label') %>
    <ul>
      <% if params[:q].present? %>
        <%= user_list_link(t('users.listing_relevance'), sort: nil) %>
      <% end %>
      <%= user_list_link(t('users.listing_registration_date'), sort: params[:q].present? ? 'created' : nil) %>
      <%= user_list_link(t('users.listing_sort_name'), sort: 'name') %>
      <%= user_list_link(t('scripts.listing_sort_daily_installs'), sort: 'daily_installs') %>
      <%= user_list_link(t('scripts.listing_sort_total_installs'), sort: 'total_installs') %>
      <%= user_list_link(t('scripts.listing_sort_ratings'), sort: 'ratings') %>
      <%= user_list_link(t('users.listing_number_of_scripts'), sort: 'scripts') %>
      <%= user_list_link(t('users.listing_new_scripts'), sort: 'created_script') %>
      <%= user_list_link(t('users.listing_updated_scripts'), sort: 'updated_script') %>
    </ul>
  </div>

  <div id="user-banned-filter" class="list-option-group">
    <ul>
      <%= user_list_link(t('users.listing_banned_filter.all'), banned: nil) %>
      <%= user_list_link(t('users.listing_banned_filter.banned'), banned: '1') %>
      <%= user_list_link(t('users.listing_banned_filter.not_banned'), banned: '0') %>
    </ul>
  </div>

  <div id="user-author-filter" class="list-option-group">
    <ul>
      <%= user_list_link(t('users.listing_author_filter.all'), author: nil) %>
      <%= user_list_link(t('users.listing_author_filter.script_author'), author: '1') %>
      <%= user_list_link(t('users.listing_author_filter.not_script_author'), author: '0') %>
    </ul>
  </div>
</div>
