Sha256: 69a1586a13857f68d302c568150b7ecfefa99ec5231bd8ec8a44de6a46d3afec

Contents?: true

Size: 1021 Bytes

Versions: 8

Compression:

Stored size: 1021 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # Controller that allows managing participatory process step activations.
    #
    class ParticipatoryProcessStepActivationsController < Decidim::Admin::ApplicationController
      include Concerns::ParticipatoryProcessAdmin

      def create
        authorize! :activate, process_step

        ActivateParticipatoryProcessStep.call(process_step) do
          on(:ok) do
            flash[:notice] = I18n.t("participatory_process_step_activations.create.success", scope: "decidim.admin")
          end

          on(:invalid) do
            flash.now[:alert] = I18n.t("participatory_process_step_activations.create.error", scope: "decidim.admin")
          end

          redirect_to participatory_process_steps_path(current_participatory_process)
        end
      end

      private

      def process_step
        collection.find(params[:step_id])
      end

      def collection
        current_participatory_process.steps
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-admin-0.5.1 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.5.1 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-admin-0.5.0 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.5.0 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-admin-0.4.4 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.4.4 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-admin-0.4.3 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.4.3 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb