Sha256: 86deab327a94165e098d0e7262a9a9d87f42750cd08ef13f7c827901351026c0

Contents?: true

Size: 796 Bytes

Versions: 15

Compression:

Stored size: 796 Bytes

Contents

module Para
  module Admin
    class ExportsController < Para::Admin::JobsController
      layout false

      before_action :load_exporter

      def create
        job = @exporter.perform_later(
          model_name: @component.try(:model).try(:name),
          search: params[:q]&.permit!,
          params: params.permit(@exporter.params_whitelist).to_h
        )

        track_job(job)
      end

      private

      def load_exporter
        exporter_name = params[:exporter]

        @exporter = @component.exporters.find do |exporter|
          exporter.name == exporter_name
        end

        unless @exporter
          raise "Requested exporter (#{ exporter_name }) not found for " +
                ":#{ @component.identifier } component."
        end
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
para-0.12.4 app/controllers/para/admin/exports_controller.rb
para-0.12.3 app/controllers/para/admin/exports_controller.rb
para-0.12.2 app/controllers/para/admin/exports_controller.rb
para-0.12.1 app/controllers/para/admin/exports_controller.rb
para-0.12.0 app/controllers/para/admin/exports_controller.rb
para-0.11.4 app/controllers/para/admin/exports_controller.rb
para-0.11.3 app/controllers/para/admin/exports_controller.rb
para-0.11.2 app/controllers/para/admin/exports_controller.rb
para-0.11.1 app/controllers/para/admin/exports_controller.rb
para-0.11.0 app/controllers/para/admin/exports_controller.rb
para-0.10.0 app/controllers/para/admin/exports_controller.rb
para-0.9.4 app/controllers/para/admin/exports_controller.rb
para-0.9.3.3 app/controllers/para/admin/exports_controller.rb
para-0.9.3.2 app/controllers/para/admin/exports_controller.rb
para-0.9.3.1 app/controllers/para/admin/exports_controller.rb