Class: BulkSubmissionExcel::DownloadsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/bulk_submission_excel/downloads_controller.rb

Overview

Generate a bulk submission excel template from basic user provided data

Constant Summary collapse

CONTENT_TYPE =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'

Constants included from FlashTruncation

FlashTruncation::STRING_OVERHEAD

Instance Method Summary collapse

Methods inherited from ApplicationController

#block_api_access, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!

Methods included from FlashTruncation

#max_flash_size, #truncate_flash, #truncate_flash_array

Instance Method Details

#createObject



15
16
17
18
19
20
21
22
23
# File 'app/controllers/bulk_submission_excel/downloads_controller.rb', line 15

def create
  download = build_download
  file = save_download_to_file(download)
  send_file_to_user(file)
rescue Asset::Finder::InvalidInputException => e
  handle_invalid_input_exception(e)
ensure
  file&.close
end

#newObject



8
9
10
11
12
13
# File 'app/controllers/bulk_submission_excel/downloads_controller.rb', line 8

def new
  @submission_template = SubmissionTemplate.find_by(id: params[:submission_template_id])
  @input_field_infos = @submission_template&.input_field_infos || []
  @input_field_infos.reject! { |k| k.key == :customer_accepts_responsibility }
  render 'new', layout: !request.xhr?
end