Class: Spotlight::CustomFieldsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Spotlight::CustomFieldsController
- Defined in:
- app/controllers/spotlight/custom_fields_controller.rb
Overview
CRUD actions for exhibit custom field management.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 22 def create @custom_field.attributes = custom_field_params @custom_field.exhibit = current_exhibit if @custom_field.save redirect_to (@custom_field.exhibit), notice: t(:'helpers.submit.custom_field.created', model: @custom_field.class.model_name.human.downcase) else render action: 'new' end end |
#destroy ⇒ Object
43 44 45 46 47 48 |
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 43 def destroy @custom_field.destroy redirect_to (@custom_field.exhibit), notice: t(:'helpers.submit.custom_field.destroyed', model: @custom_field.class.model_name.human.downcase) end |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 18 def edit (@custom_field.label, edit_exhibit_custom_field_path(@custom_field.exhibit, @custom_field)) end |
#new ⇒ Object
13 14 15 16 |
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 13 def new @custom_field.field_type ||= 'text' (t(:'helpers.action.spotlight/custom_field.create'), new_exhibit_custom_field_path(@exhibit)) end |
#update ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/spotlight/custom_fields_controller.rb', line 34 def update if @custom_field.update custom_field_params redirect_to (@custom_field.exhibit), notice: t(:'helpers.submit.custom_field.updated', model: @custom_field.class.model_name.human.downcase) else render action: 'edit' end end |