Module: Workarea::Search::AdminSorting
- Included in:
- AdminAssets, AdminCategories, AdminDiscounts, AdminFulfillmentSkus, AdminInventorySkus, AdminOrders, AdminPages, AdminPaymentTransactions, AdminPricingSkus, AdminProducts, AdminReleasables, AdminReleases, AdminSearch, AdminSegments, AdminUsers
- Defined in:
- app/queries/workarea/search/admin_sorting.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
Instance Method Details
#current_sort ⇒ Object
14 15 16 |
# File 'app/queries/workarea/search/admin_sorting.rb', line 14 def current_sort AdminSorting.available_sorts.find(params[:sort]) end |
#default_admin_sort ⇒ Object
18 19 20 |
# File 'app/queries/workarea/search/admin_sorting.rb', line 18 def default_admin_sort [{ _score: :desc }, { updated_at: :desc }] end |
#sort ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/queries/workarea/search/admin_sorting.rb', line 26 def sort sort = super return sort unless sort.blank? if current_sort.field.present? user_selected_sort else default_admin_sort end end |
#user_selected_sort ⇒ Object
22 23 24 |
# File 'app/queries/workarea/search/admin_sorting.rb', line 22 def user_selected_sort [{ current_sort.field => current_sort.direction }] end |