Class: Spotlight::FiltersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Spotlight::FiltersController
- Defined in:
- app/controllers/spotlight/filters_controller.rb
Overview
Create and update filters for an exhibit
Instance Method Summary collapse
Methods included from Concerns::ApplicationController
#enabled_in_spotlight_view_type_configuration?, #field_enabled?
Methods included from Controller
#add_breadcrumb, #blacklight_config, #breadcrumbs, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #default_url_options, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_path, #resource_masthead?, #search_action_url, #search_facet_path, #search_state, #set_exhibit_locale_scope, #set_locale
Methods included from Config
#exhibit_specific_blacklight_config
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/spotlight/filters_controller.rb', line 10 def create if @filter.save flash[:notice] = t('helpers.submit.filter.updated', model: @filter.model_name.human) else flash[:alert] = @filter.errors..join('<br/>'.html_safe) end redirect_to spotlight.edit_exhibit_path @exhibit, tab: 'filter' end |
#filter_params ⇒ Object
24 25 26 |
# File 'app/controllers/spotlight/filters_controller.rb', line 24 def filter_params params.require(:filter).permit(:field, :value) end |
#update ⇒ Object
19 20 21 22 |
# File 'app/controllers/spotlight/filters_controller.rb', line 19 def update flash[:alert] = @filter.errors..join('<br/>'.html_safe) unless @filter.update(filter_params) redirect_to spotlight.edit_exhibit_path @exhibit, tab: 'filter' end |