Class: Renalware::Reporting::AuditsController

Inherits:
BaseController show all
Includes:
PresenterHelper
Defined in:
app/controllers/renalware/reporting/audits_controller.rb

Instance Method Summary collapse

Methods included from PresenterHelper

#present

Methods inherited from BaseController

#patient

Instance Method Details

#editObject



23
24
25
26
# File 'app/controllers/renalware/reporting/audits_controller.rb', line 23

def edit
  authorize audit
  render_edit
end

#indexObject



10
11
12
13
# File 'app/controllers/renalware/reporting/audits_controller.rb', line 10

def index
  authorize Audit, :index?
  render locals: { audits: present(Audit.enabled, AuditPresenter) }
end

#showObject



15
16
17
18
19
20
21
# File 'app/controllers/renalware/reporting/audits_controller.rb', line 15

def show
  authorize audit
  respond_to do |format|
    format.html { render locals: { audit: audit } }
    format.json { render json: FetchAuditJson.call(audit.view_name) }
  end
end

#updateObject



28
29
30
31
32
33
34
35
# File 'app/controllers/renalware/reporting/audits_controller.rb', line 28

def update
  authorize audit
  if audit.update(audit_params)
    redirect_to reporting_audits_path, notice: success_msg_for("audit")
  else
    render_edit
  end
end