Class: Locomotive::CustomFields::SelectOptionsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/custom_fields/select_options_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



12
13
14
# File 'app/controllers/locomotive/custom_fields/select_options_controller.rb', line 12

def edit
  respond_with @custom_field
end

#new_optionObject



21
22
23
24
25
26
27
28
# File 'app/controllers/locomotive/custom_fields/select_options_controller.rb', line 21

def new_option
  if params[:select_option].present?
    option = @custom_field.select_options.build(name: option_name_param)
    render partial: 'option', locals: { select_option: option }
  else
    head :unprocessable_entity
  end
end

#updateObject



16
17
18
19
# File 'app/controllers/locomotive/custom_fields/select_options_controller.rb', line 16

def update
  @options = service.update_select_options(options_params.map(&:to_h))
  respond_with @custom_field, location: -> { last_saved_location!(default_back_location) }
end