Sha256: 5da437f4502d24e6049bf40b3e10e93c926f9f5c5caac44c062b1ad5dcede20b

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require_dependency "decidim/admin/application_controller"

module Decidim
  module Admin
    # Controller that allows managing participatory process step activations.
    #
    class ParticipatoryProcessStepActivationsController < 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

4 entries across 4 versions & 2 rubygems

Version Path
decidim-admin-0.4.2 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-admin-0.4.1 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.4.2 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.4.1 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb