Sha256: 5ce3927c6214fc64009a87511ed1a066b80ac30d76b0cb54c728053dde3a88a1

Contents?: true

Size: 976 Bytes

Versions: 37

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    module Admin
      class ProposalsMergesController < Admin::ApplicationController
        def create
          enforce_permission_to :merge, :proposals

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

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

            on(:invalid) do
              flash[:alert_html] = Decidim::ValidationErrorsPresenter.new(
                I18n.t("proposals_merges.create.invalid", scope: "decidim.proposals.admin"),
                @form
              ).message
              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.26.8 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.27.4 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.27.3 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.7 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.5 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.27.2 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.27.1 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.4 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.27.0 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.3 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.27.0.rc2 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.27.0.rc1 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.2 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.1 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.0 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.0.rc2 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb
decidim-proposals-0.26.0.rc1 app/controllers/decidim/proposals/admin/proposals_merges_controller.rb