Sha256: ec25630986e8cc74f6e2033679a7db5fb2f1b9a17bb0928a7e5cceda82de723b

Contents?: true

Size: 906 Bytes

Versions: 51

Compression:

Stored size: 906 Bytes

Contents

class Marty::ReportController < Marty::ApplicationController
  def index
    format, req_disposition, title =
      params[:format], params[:disposition], params[:reptitle]

    raise 'bad format' unless Marty::ContentHandler::GEN_FORMATS.member?(format)

    data = Marty::ReportForm.run_eval(params)

    # hacky: shouldn't have error parsing logic here
    format = 'json' if data.is_a?(Hash) && (data[:error] || data['error'])

    # hack for testing -- txt -> csv
    exp_format = format == 'txt' ? 'csv' : format

    res, type, disposition, filename =
      Marty::ContentHandler.
        export(data, exp_format, title)

    # hack for testing -- set content-type
    type = 'text/plain' if format == 'txt' && type =~ /csv/

    send_data(res,
              type:        type,
              filename:    filename,
              disposition: req_disposition || disposition,
             )
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
marty-14.3.0 app/controllers/marty/report_controller.rb
marty-14.0.0 app/controllers/marty/report_controller.rb
marty-13.0.2 app/controllers/marty/report_controller.rb
marty-11.0.0 app/controllers/marty/report_controller.rb
marty-10.0.3 app/controllers/marty/report_controller.rb
marty-10.0.2 app/controllers/marty/report_controller.rb
marty-10.0.0 app/controllers/marty/report_controller.rb
marty-9.5.1 app/controllers/marty/report_controller.rb
marty-9.5.0 app/controllers/marty/report_controller.rb
marty-9.3.3 app/controllers/marty/report_controller.rb
marty-9.3.2 app/controllers/marty/report_controller.rb
marty-9.3.0 app/controllers/marty/report_controller.rb
marty-8.5.0 app/controllers/marty/report_controller.rb
marty-8.4.1 app/controllers/marty/report_controller.rb
marty-8.3.1 app/controllers/marty/report_controller.rb
marty-8.2.0 app/controllers/marty/report_controller.rb
marty-8.0.0 app/controllers/marty/report_controller.rb
marty-6.1.0 app/controllers/marty/report_controller.rb
marty-5.2.0 app/controllers/marty/report_controller.rb
marty-5.1.4 app/controllers/marty/report_controller.rb