Class: Workarea::Admin::SearchSettingsController
- Inherits:
-
ApplicationController
- Object
- Workarea::ApplicationController
- ApplicationController
- Workarea::Admin::SearchSettingsController
- Defined in:
- app/controllers/workarea/admin/search_settings_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
Instance Method Details
#show ⇒ Object
6 7 8 9 |
# File 'app/controllers/workarea/admin/search_settings_controller.rb', line 6 def show @settings = Search::Settings.current @price_facets = @settings.range_facets['price'] || [] end |
#update ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/workarea/admin/search_settings_controller.rb', line 11 def update clean_range_facets = CleanRangeFacets.new(params[:range_facets]) attributes = { synonyms: params[:synonyms], boosts: params[:boosts].to_h.presence, views_factor: params[:views_factor], terms_facets_list: params[:terms_facets_list], range_facets: clean_range_facets.result.presence, }.merge(params[:settings] || {}).compact Search::Settings.current.update_attributes!(attributes) flash[:success] = t('workarea.admin.search_settings.flash_messages.saved') redirect_to return_to.presence || search_settings_path end |