Class: Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessGroupsController
- Inherits:
-
ApplicationController
- Object
- Admin::ApplicationController
- ApplicationController
- Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessGroupsController
- Includes:
- TranslatableAttributes
- Defined in:
- app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb
Overview
Controller that allows managing participatory process groups.
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb', line 27 def create :create, :process_group @form = form(ParticipatoryProcessGroupForm).from_params(params) CreateParticipatoryProcessGroup.call(@form) do on(:ok) do |participatory_process_group| flash[:notice] = I18n.t("participatory_processes_group.create.success", scope: "decidim.admin") redirect_to edit_participatory_process_group_path(participatory_process_group) end on(:invalid) do flash.now[:alert] = I18n.t("participatory_processes_group.create.error", scope: "decidim.admin") render :new end end end |
#destroy ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb', line 69 def destroy @participatory_process_group = collection.find(params[:id]) :destroy, :process_group, process_group: @participatory_process_group Decidim::Commands::DestroyResource.call(@participatory_process_group, current_user) do on(:ok) do flash[:notice] = I18n.t("participatory_process_groups.destroy.success", scope: "decidim.admin") redirect_to action: :index end on(:invalid) do flash.now[:alert] = I18n.t("participatory_process_groups.destroy.error", scope: "decidim.admin") render :index end end end |
#edit ⇒ Object
44 45 46 47 48 49 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb', line 44 def edit @item = collection.find(params[:id]) :update, :process_group, process_group: @item @form = form(ParticipatoryProcessGroupForm).from_model(@item) render layout: "decidim/admin/participatory_process_group" end |
#index ⇒ Object
18 19 20 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb', line 18 def index :read, :process_group end |
#new ⇒ Object
22 23 24 25 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb', line 22 def new :create, :process_group @form = form(ParticipatoryProcessGroupForm).instance end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb', line 51 def update @participatory_process_group = collection.find(params[:id]) :update, :process_group, process_group: @participatory_process_group @form = form(ParticipatoryProcessGroupForm).from_params(params) UpdateParticipatoryProcessGroup.call(@form, @participatory_process_group) do on(:ok) do |participatory_process_group| flash[:notice] = I18n.t("participatory_process_groups.update.success", scope: "decidim.admin") redirect_to edit_participatory_process_group_path(participatory_process_group) end on(:invalid) do flash.now[:alert] = I18n.t("participatory_process_groups.update.error", scope: "decidim.admin") render :edit, layout: "decidim/admin/participatory_process_group" end end end |