Sha256: b45bc6e0aa5745ef1ff791086e7e43934a79ebcc7f190bf3fed0177c45a064da

Contents?: true

Size: 996 Bytes

Versions: 85

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Proposals
    module Admin
      class ProposalsImportsController < Admin::ApplicationController
        def new
          enforce_permission_to :import, :proposals

          @form = form(Admin::ProposalsImportForm).instance
        end

        def create
          enforce_permission_to :import, :proposals

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

          Admin::ImportProposals.call(@form) do
            on(:ok) do |proposals|
              flash[:notice] = I18n.t("proposals_imports.create.success", scope: "decidim.proposals.admin", number: proposals.length)
              redirect_to EngineRouter.admin_proxy(current_component).root_path
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("proposals_imports.create.invalid", scope: "decidim.proposals.admin")
              render action: "new"
            end
          end
        end
      end
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
decidim-proposals-0.29.1 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.28.4 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.27.9 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.29.0 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.28.3 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.27.8 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.29.0.rc4 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.29.0.rc3 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.29.0.rc2 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.29.0.rc1 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.28.2 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.27.7 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.28.1 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.27.6 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.26.10 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.26.9 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.28.0 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.27.5 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.28.0.rc5 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb
decidim-proposals-0.28.0.rc4 app/controllers/decidim/proposals/admin/proposals_imports_controller.rb