Class: Renalware::PD::ExitSiteInfectionsController

Inherits:
BaseController show all
Includes:
PresenterHelper, Concerns::PdfRenderable
Defined in:
app/controllers/renalware/pd/exit_site_infections_controller.rb

Instance Method Summary collapse

Methods included from PresenterHelper

#present

Methods inherited from BaseController

#patient

Instance Method Details

#createObject



26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/renalware/pd/exit_site_infections_controller.rb', line 26

def create
  esi = ExitSiteInfection.new(exit_site_infection_params.merge!(patient_id: patient.id))
  authorize esi
  if esi.save
    redirect_to patient_pd_exit_site_infection_path(patient, esi),
                notice: t(".success", model_name: "exit site infection")
  else
    flash.now[:error] = t(".failed", model_name: "exit site infection")
    render_new(esi)
  end
end

#editObject



38
39
40
41
# File 'app/controllers/renalware/pd/exit_site_infections_controller.rb', line 38

def edit
  authorize exit_site_infection
  render locals: locals
end

#newObject



20
21
22
23
24
# File 'app/controllers/renalware/pd/exit_site_infections_controller.rb', line 20

def new
  esi = ExitSiteInfection.new
  authorize esi
  render_new(esi)
end

#showObject



11
12
13
14
15
16
17
18
# File 'app/controllers/renalware/pd/exit_site_infections_controller.rb', line 11

def show
  authorize exit_site_infection
  respond_to do |format|
    format.html { render_show }
    format.js   { render_show }
    format.pdf  { render_esi_as_pdf_printout }
  end
end

#updateObject



43
44
45
46
47
48
49
50
51
52
# File 'app/controllers/renalware/pd/exit_site_infections_controller.rb', line 43

def update
  authorize exit_site_infection
  if exit_site_infection.update(exit_site_infection_params)
    redirect_to patient_pd_exit_site_infection_path(patient, exit_site_infection),
                notice: t(".success", model_name: "exit site infection")
  else
    flash.now[:error] = t(".failed", model_name: "exit site infection")
    render_edit
  end
end