app/views/artifacts/_search_order_dropdown.html.haml
.dropdown.pad-bottom#search-order-dropdown
%button.btn.btn-default.dropdown-toggle{type: 'button', id: 'search-order-button', :'data-toggle' => 'dropdown'}
= t('.order_by')
= t(".#{params[:order] || 'created_at'}_#{params[:asc] ? 'asc' : 'desc'}").downcase
%span.caret
%ul.dropdown-menu
- current_params = params.slice(*(Artifact.search_fields + ['q']))
%li
= link_to t('.top_rated_desc'), artifacts_path(current_params.merge(order: 'top_rated'))
%li
= link_to t('.most_downloaded_desc'), artifacts_path(current_params.merge(order: 'most_downloaded'))
- ['name', 'created_at', 'updated_at'].each do |attribute|
%li
= link_to t(".#{attribute}_asc"), artifacts_path(current_params.merge(order: attribute, asc: true))
= link_to t(".#{attribute}_desc"), artifacts_path(current_params.merge(order: attribute))