Class: Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessesController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessesController
- Includes:
- Admin::ParticipatorySpaceAdminContext, Filterable
- Defined in:
- app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb
Overview
Controller that allows managing participatory processes.
Instance Method Summary collapse
Instance Method Details
#copy ⇒ Object
76 77 78 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb', line 76 def copy :create, Decidim::ParticipatoryProcess end |
#create ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb', line 33 def create :create, :process @form = form(ParticipatoryProcessForm).from_params(params) CreateParticipatoryProcess.call(@form) do on(:ok) do |participatory_process| flash[:notice] = I18n.t("participatory_processes.create.success", scope: "decidim.admin") redirect_to participatory_process_steps_path(participatory_process) end on(:invalid) do flash.now[:alert] = I18n.t("participatory_processes.create.error", scope: "decidim.admin") render :new end end end |
#edit ⇒ Object
50 51 52 53 54 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb', line 50 def edit :update, :process, process: current_participatory_process @form = form(ParticipatoryProcessForm).from_model(current_participatory_process) render layout: "decidim/admin/participatory_process" end |
#index ⇒ Object
23 24 25 26 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb', line 23 def index :read, :process_list @participatory_processes = filtered_collection end |
#new ⇒ Object
28 29 30 31 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb', line 28 def new :create, :process @form = form(ParticipatoryProcessForm).instance end |
#update ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb', line 56 def update :update, :process, process: current_participatory_process @form = form(ParticipatoryProcessForm).from_params( participatory_process_params, process_id: current_participatory_process.id ) UpdateParticipatoryProcess.call(@form, current_participatory_process) do on(:ok) do |participatory_process| flash[:notice] = I18n.t("participatory_processes.update.success", scope: "decidim.admin") redirect_to edit_participatory_process_path(participatory_process) end on(:invalid) do flash.now[:alert] = I18n.t("participatory_processes.update.error", scope: "decidim.admin") render :edit, layout: "decidim/admin/participatory_process" end end end |