Sha256: 0761dc7017de4af37e5f51338d788f06462208fab41cd928d0c60e386c782738

Contents?: true

Size: 837 Bytes

Versions: 31

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Accountability
    module Admin
      # This controller allows an admin to import results from a csv file for the Accountability component
      class ImportResultsController < Admin::ApplicationController
        def new
          @errors = []
        end

        def create
          @csv_file = params[:csv_file]
          redirect_to(new_import_path) && return if @csv_file.blank?

          Decidim::Accountability::Admin::ImportResultsCsvJob.perform_later(current_user, current_component, @csv_file.read.force_encoding("utf-8").encode("utf-8"))

          flash[:notice] = I18n.t("imports.create.success", scope: "decidim.accountability.admin")
          redirect_to import_results_path(current_participatory_space, current_component)
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-accountability-0.27.9 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.8 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.7 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.6 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.10 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.9 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.5 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.8 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.4 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.3 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.7 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.5 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.2 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.1 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.4 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.0 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.3 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.0.rc2 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.27.0.rc1 app/controllers/decidim/accountability/admin/import_results_controller.rb
decidim-accountability-0.26.2 app/controllers/decidim/accountability/admin/import_results_controller.rb