Class: Renalware::HD::Scheduling::DiariesController

Inherits:
BaseController show all
Includes:
Concerns::Pageable, Concerns::PdfRenderable
Defined in:
app/controllers/renalware/hd/scheduling/diaries_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#patient

Instance Method Details

#editObject



16
17
18
19
20
21
22
# File 'app/controllers/renalware/hd/scheduling/diaries_controller.rb', line 16

def edit
  authorize weekly_diary, :show?
  render locals: {
    unit: unit,
    diary: DiaryPresenter.new(current_user, weekly_diary)
  }
end

#indexObject

Renders a list of diaries for a hospital unit



25
26
27
28
# File 'app/controllers/renalware/hd/scheduling/diaries_controller.rb', line 25

def index
  authorize WeeklyDiary, :index?
  render locals: { unit: unit, diaries: weekly_diaries }
end

#showObject



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/renalware/hd/scheduling/diaries_controller.rb', line 30

def show
  diary = WeeklyDiary.find(params[:id])
  respond_to do |format|
    format.pdf do
      authorize diary
      options = default_pdf_options.merge!(
        pdf: pdf_filename,
        locals: { unit: unit, diary: DiaryPresenter.new(current_user, diary) }
      )
      render options
    end
  end
end