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-0.5.31 app/controllers/marty/report_controller.rb
marty-0.5.30 app/controllers/marty/report_controller.rb
marty-0.5.29 app/controllers/marty/report_controller.rb
marty-0.5.28 app/controllers/marty/report_controller.rb
marty-0.5.27 app/controllers/marty/report_controller.rb
marty-0.5.26 app/controllers/marty/report_controller.rb
marty-0.5.25 app/controllers/marty/report_controller.rb
marty-0.5.24 app/controllers/marty/report_controller.rb
marty-0.5.23 app/controllers/marty/report_controller.rb
marty-0.5.21 app/controllers/marty/report_controller.rb
marty-0.5.20 app/controllers/marty/report_controller.rb