Sha256: 225e8a9c61360aa72bd89fdcd22270eb29887ec52f708ab556e27dd7b1816809

Contents?: true

Size: 721 Bytes

Versions: 5

Compression:

Stored size: 721 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]
        )

        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

5 entries across 5 versions & 1 rubygems

Version Path
para-0.7.1 app/controllers/para/admin/exports_controller.rb
para-0.7.0 app/controllers/para/admin/exports_controller.rb
para-0.6.9 app/controllers/para/admin/exports_controller.rb
para-0.6.8 app/controllers/para/admin/exports_controller.rb
para-0.6.7 app/controllers/para/admin/exports_controller.rb