Sha256: 9d2495d91201f9407cf0feb3c743270f14040d2bed9525d789c884e9c68c312a
Contents?: true
Size: 927 Bytes
Versions: 3
Compression:
Stored size: 927 Bytes
Contents
# frozen_string_literal: true module Decidim module Pages module Admin # This controller allows the user to update a Page. class PagesController < Admin::ApplicationController def edit @form = form(Admin::PageForm).from_model(page) end def update @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 private def page @page ||= Pages::Page.find_by(component: current_component) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems