Sha256: 234d4c804cf22ad87ae2dd5c77a99f8a0e0eae26c970f26f81b6ab4837ecc185

Contents?: true

Size: 835 Bytes

Versions: 8

Compression:

Stored size: 835 Bytes

Contents

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

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

      def create
        authorize! :reorder, Decidim::ParticipatoryProcessStep
        ReorderParticipatoryProcessSteps.call(collection, params[:items_ids]) do
          on(:invalid) do
            flash.now[:alert] = I18n.t("participatory_process_steps.ordering.error", scope: "decidim.admin")
            redirect_to participatory_process_path(participatory_process)
          end
        end
      end

      private

      def collection
        participatory_process.steps
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-admin-0.1.0 app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
decidim-0.1.0 decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
decidim-admin-0.0.8.1 app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
decidim-0.0.8.1 decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
decidim-admin-0.0.7 app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
decidim-0.0.7 decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
decidim-admin-0.0.6 app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
decidim-0.0.6 decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb