Sha256: e8bfb165c136cfa8d4f4aca34e87322af8ad2f3fa0062f24abce833b94c2cc0a

Contents?: true

Size: 872 Bytes

Versions: 37

Compression:

Stored size: 872 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    module Admin
      class ProposalsSplitsController < Admin::ApplicationController
        def create
          enforce_permission_to :split, :proposals

          @form = form(Admin::ProposalsSplitForm).from_params(params)

          Admin::SplitProposals.call(@form) do
            on(:ok) do |_proposal|
              flash[:notice] = I18n.t("proposals_splits.create.success", scope: "decidim.proposals.admin")
              redirect_to EngineRouter.admin_proxy(@form.target_component).root_path
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("proposals_splits.create.invalid", scope: "decidim.proposals.admin")
              redirect_to EngineRouter.admin_proxy(current_component).root_path
            end
          end
        end
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
decidim-proposals-0.23.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.22.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.21.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.20.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.20.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.19.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.18.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.19.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.17.2 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.18.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.17.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.16.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.17.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.16.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.15.2 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.15.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.15.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb