Class: EasySettingsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- EasySettingsController
- Defined in:
- app/controllers/easy_settings_controller.rb
Overview
For now edit and update actions are for a plugin settings
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
10 11 12 13 |
# File 'app/controllers/easy_settings_controller.rb', line 10 def edit @settings = Setting.send("plugin_#{@plugin.id}") @easy_settings = EasySettings::FormModel.new(prefix: @plugin.id, project: @project) end |
#update ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/controllers/easy_settings_controller.rb', line 15 def update if params[:settings] Setting.send("plugin_#{@plugin.id}=", params[:settings].permit!) end if params[:easy_setting] @easy_settings = EasySettings::ParamsWrapper.from_params(params[:easy_setting].permit!, project: @project, prefix: @plugin.id) if @easy_settings.save # All good else render :edit return end end flash[:notice] = l(:notice_successful_update) redirect_back_or_default edit_easy_setting_path(@plugin.id) end |