Class: Decidim::Plans::Admin::SectionsController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Plans::Admin::SectionsController
- Includes:
- ApplicationHelper
- Defined in:
- app/controllers/decidim/plans/admin/sections_controller.rb
Overview
This controller allows admins to manage plans in a participatory process.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/decidim/plans/admin/sections_controller.rb', line 19 def create :create, :section @form = form(Admin::PlanSectionsForm).from_params(params) Admin::UpdateSections.call(@form, sections) do on(:ok) do flash[:notice] = I18n.t("update.success", scope: i18n_flashes_scope) redirect_to sections_url end on(:invalid) do flash.now[:alert] = I18n.t("update.invalid", scope: i18n_flashes_scope) render action: :index end end end |
#edit ⇒ Object
36 37 38 |
# File 'app/controllers/decidim/plans/admin/sections_controller.rb', line 36 def edit :edit, :section, section: section end |
#index ⇒ Object
14 15 16 17 |
# File 'app/controllers/decidim/plans/admin/sections_controller.rb', line 14 def index :create, :sections @form = form(Admin::PlanSectionsForm).from_model(sections) end |
#update ⇒ Object
40 41 42 |
# File 'app/controllers/decidim/plans/admin/sections_controller.rb', line 40 def update :edit, :section, section: section end |