Class: Decidim::Pages::Admin::PagesController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Pages::Admin::PagesController
- Defined in:
- app/controllers/decidim/pages/admin/pages_controller.rb
Overview
This controller allows the user to update a Page.
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
8 9 10 11 12 |
# File 'app/controllers/decidim/pages/admin/pages_controller.rb', line 8 def edit :update, :page @form = form(Admin::PageForm).from_model(page) end |
#update ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/decidim/pages/admin/pages_controller.rb', line 14 def update :update, :page @form = form(Admin::PageForm).from_params(params) Admin::UpdatePage.call(@form, page) do on(:ok) do flash[:notice] = I18n.t("pages.update.success", scope: "decidim.pages.admin") redirect_to parent_path end on(:invalid) do flash.now[:alert] = I18n.t("pages.update.invalid", scope: "decidim.pages.admin") render action: "edit" end end end |