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.25.2 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.25.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.25.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.25.0.rc4 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.25.0.rc3 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.25.0.rc2 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.25.0.rc1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.24.3 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.23.6 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.24.2 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.23.5 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.24.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.24.0 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.24.0.rc2 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.23.4 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.24.0.rc1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.23.3 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.23.2 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.23.1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb
decidim-proposals-0.23.1.rc1 app/controllers/decidim/proposals/admin/proposals_splits_controller.rb