Class: Workarea::Search::AdminUsers
- Inherits:
-
Object
- Object
- Workarea::Search::AdminUsers
- Includes:
- AdminIndexSearch, AdminSorting, Pagination, Query
- Defined in:
- app/queries/workarea/search/admin_users.rb
Class Method Summary collapse
Instance Method Summary collapse
- #facets ⇒ Object
-
#initialize(params = {}) ⇒ AdminUsers
constructor
A new instance of AdminUsers.
- #sort ⇒ Object
Methods included from Pagination
#each_by, #from, #page, #per_page, #results, #size
Methods included from AdminSorting
#current_sort, #default_admin_sort, #user_selected_sort
Methods included from AdminIndexSearch
#aggregations, #autocomplete?, #exclude_filter_clause, #fields, #filters, #jump_to_navigation_filter_clause, #post_filter, #query, #sanitized_query
Methods included from Query
#additional_options, #aggregations, #body, #id, #load_model_from, #loaded_results, #post_filter, #query, #query_string, #response, #results, #scroll, #stats, #total
Constructor Details
#initialize(params = {}) ⇒ AdminUsers
Returns a new instance of AdminUsers.
19 20 21 |
# File 'app/queries/workarea/search/admin_users.rb', line 19 def initialize(params = {}) super(params.merge(type: 'user')) end |
Class Method Details
.available_sorts ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/queries/workarea/search/admin_users.rb', line 11 def self.available_sorts Sort::Collection.new( Sort.most_spent, Sort.most_orders, Sort.average_order_value ) end |
Instance Method Details
#facets ⇒ Object
23 24 25 |
# File 'app/queries/workarea/search/admin_users.rb', line 23 def facets super + [TermsFacet.new(self, 'role')] end |
#sort ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'app/queries/workarea/search/admin_users.rb', line 27 def sort Array.wrap(super).tap do |sort| current_sort = self.class.available_sorts.detect { |s| s.to_s == params[:sort] } if current_sort.present? && current_sort.field.present? sort.prepend(current_sort.field => current_sort.direction) end end end |