Class: Renalware::HD::SessionForms::BatchesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- ApplicationController
- BaseController
- BaseController
- Renalware::HD::SessionForms::BatchesController
- Defined in:
- app/controllers/renalware/hd/session_forms/batches_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#show ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#status ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods inherited from BaseController
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/renalware/hd/session_forms/batches_controller.rb', line 9 def create batch = create_unprocessed_batch_and_batch_items batch Delayed::Job.enqueue BatchPrintJob.new(batch.id, current_user.id) respond_to do |format| format.js { render locals: { batch: batch } } end end |
#show ⇒ Object
rubocop:disable Metrics/MethodLength
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/renalware/hd/session_forms/batches_controller.rb', line 41 def show batch = respond_to do |format| format.pdf do # Returns the PDF itself using path saved in the Batch - provided status is correct send_file( batch.filepath, type: "application/pdf", disposition: "inline", filename: "session_forms_batch_#{batch.id}.pdf" ) end format.html do # Returns a partial with a link to the compiled batch pdf render layout: false, locals: { batch: } end end end |
#status ⇒ Object
rubocop:disable Metrics/MethodLength
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/renalware/hd/session_forms/batches_controller.rb', line 22 def status batch = (params[:batch_id]) respond_to do |format| format.json { render( status: :ok, json: { id: batch.id, status: batch.status, percent_complete: batch.percent_complete } ) } end end |