Class: Decidim::ActionDelegator::Admin::SettingsController
- Inherits:
-
ApplicationController
- Object
- Decidim::Admin::ApplicationController
- ApplicationController
- Decidim::ActionDelegator::Admin::SettingsController
- Includes:
- Filterable, Paginable
- Defined in:
- app/controllers/decidim/action_delegator/admin/settings_controller.rb
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/decidim/action_delegator/admin/settings_controller.rb', line 24 def create :create, :setting @form = form(SettingForm).from_params(params) CreateSetting.call(@form, copy_from_setting) do on(:ok) do notice = I18n.t("settings.create.success", scope: "decidim.action_delegator.admin") redirect_to decidim_admin_action_delegator.settings_path, notice: notice end on(:invalid) do |_error| flash.now[:error] = I18n.t("settings.create.error", scope: "decidim.action_delegator.admin") render :new end end end |
#destroy ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/controllers/decidim/action_delegator/admin/settings_controller.rb', line 66 def destroy :destroy, :setting, resource: setting if setting.destroy flash[:notice] = I18n.t("settings.destroy.success", scope: "decidim.action_delegator.admin") else flash[:error] = I18n.t("settings.destroy.error", scope: "decidim.action_delegator.admin") end redirect_to settings_path end |
#edit ⇒ Object
42 43 44 45 46 |
# File 'app/controllers/decidim/action_delegator/admin/settings_controller.rb', line 42 def edit :update, :setting @form = form(SettingForm).from_model(setting) end |
#index ⇒ Object
14 15 16 |
# File 'app/controllers/decidim/action_delegator/admin/settings_controller.rb', line 14 def index :index, :setting end |
#new ⇒ Object
18 19 20 21 22 |
# File 'app/controllers/decidim/action_delegator/admin/settings_controller.rb', line 18 def new :create, :setting @form = form(SettingForm).instance end |
#update ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/decidim/action_delegator/admin/settings_controller.rb', line 48 def update :update, :setting @form = form(SettingForm).from_params(params) UpdateSetting.call(@form, setting, copy_from_setting) do on(:ok) do notice = I18n.t("settings.update.success", scope: "decidim.action_delegator.admin") redirect_to decidim_admin_action_delegator.settings_path, notice: notice end on(:invalid) do |_error| flash.now[:error] = I18n.t("settings.update.error", scope: "decidim.action_delegator.admin") render :edit end end end |