Sha256: 30bf0cc2ea2d5d58c36b14248663ddd0b2f73bcef5e2b642ec9dbbd8e6884df8

Contents?: true

Size: 985 Bytes

Versions: 131

Compression:

Stored size: 985 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/

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

Version data entries

131 entries across 131 versions & 1 rubygems

Version Path
marty-2.5.2 app/controllers/marty/report_controller.rb
marty-2.5.1 app/controllers/marty/report_controller.rb
marty-2.5.0 app/controllers/marty/report_controller.rb
marty-2.4.9 app/controllers/marty/report_controller.rb
marty-2.4.8 app/controllers/marty/report_controller.rb
marty-2.4.7 app/controllers/marty/report_controller.rb
marty-2.4.6 app/controllers/marty/report_controller.rb
marty-2.4.5 app/controllers/marty/report_controller.rb
marty-2.4.4 app/controllers/marty/report_controller.rb
marty-2.4.3 app/controllers/marty/report_controller.rb
marty-2.4.2 app/controllers/marty/report_controller.rb
marty-2.4.1 app/controllers/marty/report_controller.rb
marty-2.4.0 app/controllers/marty/report_controller.rb
marty-2.3.15 app/controllers/marty/report_controller.rb
marty-2.3.14 app/controllers/marty/report_controller.rb
marty-2.3.13 app/controllers/marty/report_controller.rb
marty-2.3.12 app/controllers/marty/report_controller.rb
marty-2.3.11 app/controllers/marty/report_controller.rb
marty-2.3.10 app/controllers/marty/report_controller.rb
marty-2.3.9 app/controllers/marty/report_controller.rb