Class: Decidim::ActionDelegator::Admin::PonderationsController
- Inherits:
-
ApplicationController
- Object
- Decidim::Admin::ApplicationController
- ApplicationController
- Decidim::ActionDelegator::Admin::PonderationsController
- Includes:
- Paginable, NeedsPermission
- Defined in:
- app/controllers/decidim/action_delegator/admin/ponderations_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/ponderations_controller.rb', line 24 def create :create, :ponderation @form = PonderationForm.from_params(params).with_context(setting: current_setting) CreatePonderation.call(@form) do on(:ok) do notice = I18n.t("ponderations.create.success", scope: "decidim.action_delegator.admin") redirect_to setting_ponderations_path(current_setting), notice: notice end on(:invalid) do |_error| flash.now[:error] = I18n.t("ponderations.create.error", scope: "decidim.action_delegator.admin") render :new end end end |
#destroy ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/decidim/action_delegator/admin/ponderations_controller.rb', line 65 def destroy :destroy, :ponderation, resource: ponderation if ponderation.destroy notice = I18n.t("ponderations.destroy.success", scope: "decidim.action_delegator.admin") redirect_to setting_ponderations_path(current_setting), notice: notice else error = I18n.t("ponderations.destroy.error", scope: "decidim.action_delegator.admin") redirect_to setting_ponderations_path(current_setting), flash: { error: error } end end |
#edit ⇒ Object
42 43 44 45 46 |
# File 'app/controllers/decidim/action_delegator/admin/ponderations_controller.rb', line 42 def edit :update, :ponderation @form = form(PonderationForm).from_model(ponderation) end |
#index ⇒ Object
14 15 16 |
# File 'app/controllers/decidim/action_delegator/admin/ponderations_controller.rb', line 14 def index :index, :ponderation end |
#new ⇒ Object
18 19 20 21 22 |
# File 'app/controllers/decidim/action_delegator/admin/ponderations_controller.rb', line 18 def new :create, :ponderation @form = form(PonderationForm).instance end |
#update ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/decidim/action_delegator/admin/ponderations_controller.rb', line 48 def update :update, :ponderation @form = PonderationForm.from_params(params).with_context(setting: current_setting) UpdatePonderation.call(@form, ponderation) do on(:ok) do notice = I18n.t("ponderations.update.success", scope: "decidim.action_delegator.admin") redirect_to setting_ponderations_path(current_setting), notice: notice end on(:invalid) do |_error| flash.now[:error] = I18n.t("ponderations.update.error", scope: "decidim.action_delegator.admin") render :edit end end end |