Sha256: a7d74edd6a8d39a0c9a25ba3168cba0518690effde707d8c8629be9af04cce37
Contents?: true
Size: 1.26 KB
Versions: 8
Compression:
Stored size: 1.26 KB
Contents
require_dependency "renalware/hd/base_controller" module Renalware module HD class ProtocolsController < BaseController before_action :load_patient def show respond_to do |format| format.pdf { disposition = params.fetch("disposition", "inline") render_pdf(disposition) } end end private def render_pdf(disposition) render( pdf_options.merge( pdf: pdf_filename, disposition: disposition, print_media_type: true, locals: { protocol: ProtocolPresenter.new(patient, view_context) } )) end # Other options to consider: # viewport_size: '1280x1024' # disable_smart_shrinking: true def pdf_options { page_size: "A4", orientation: "Landscape", layout: "renalware/layouts/pdf", margin: { top: 10, bottom: 10, left: 10, right: 10 }, footer: { font_size: 8 }, show_as_html: Rails.env.development? && params.key?("debug") } end def pdf_filename "#{patient.family_name}-#{patient.hospital_identifier.id}-protocol".upcase end end end end
Version data entries
8 entries across 8 versions & 1 rubygems