Class: Spotlight::GroupsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Spotlight::GroupsController
- Defined in:
- app/controllers/spotlight/groups_controller.rb
Overview
Base CRUD controller for groups
Instance Method Summary collapse
-
#create ⇒ Object
POST /exhibits/1/groups.
-
#destroy ⇒ Object
DELETE /groups/1.
- #index ⇒ Object
-
#update ⇒ Object
PATCH/PUT /groups/1.
- #update_all ⇒ Object
Methods included from Concerns::ApplicationController
#enabled_in_spotlight_view_type_configuration?, #field_enabled?
Methods included from Controller
#blacklight_config, #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, #set_exhibit_locale_scope, #set_locale
Methods included from Config
#exhibit_specific_blacklight_config
Instance Method Details
#create ⇒ Object
POST /exhibits/1/groups
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/spotlight/groups_controller.rb', line 20 def create @group.attributes = group_params if @group.save redirect_to( spotlight.exhibit_searches_path(anchor: 'browse-groups'), notice: t(:'helpers.submit.group.created', model: human_name) ) else redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups') end end |
#destroy ⇒ Object
DELETE /groups/1
41 42 43 44 45 |
# File 'app/controllers/spotlight/groups_controller.rb', line 41 def destroy @group.destroy redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups'), alert: t(:'helpers.submit.group.destroyed', model: human_name) end |
#index ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/controllers/spotlight/groups_controller.rb', line 11 def index respond_to do |format| format.json do render json: @groups.as_json, root: false end end end |
#update ⇒ Object
PATCH/PUT /groups/1
34 35 36 37 38 |
# File 'app/controllers/spotlight/groups_controller.rb', line 34 def update @group.update(group_params) redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups'), notice: t(:'helpers.submit.group.updated', model: human_name) end |
#update_all ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'app/controllers/spotlight/groups_controller.rb', line 47 def update_all notice = if @exhibit.update update_all_group_params t(:'helpers.submit.group.batch_updated', model: human_name) else t(:'helpers.submit.group.batch_error', model: human_name) end redirect_to spotlight.exhibit_searches_path(anchor: 'browse-groups'), notice: notice end |