Sha256: 79e88832ad33729b2d3e1dd41d05bb4eb11442fc1723826c5e69855f5fa704de

Contents?: true

Size: 1023 Bytes

Versions: 7

Compression:

Stored size: 1023 Bytes

Contents

# frozen_string_literal: true
require_dependency "decidim/admin/application_controller"

module Decidim
  module Admin
    # Controller that allows managing all the Admins.
    #
    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(participatory_process)
        end
      end

      private

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

      def collection
        participatory_process.steps
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
decidim-admin-0.0.5 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.0.5 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.0.4 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-admin-0.0.3 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.0.3 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-admin-0.0.2 app/controllers/decidim/admin/participatory_process_step_activations_controller.rb
decidim-0.0.2 decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb