Module: Renalware::PatientHelper

Defined in:
app/helpers/renalware/patient_helper.rb

Instance Method Summary collapse

Instance Method Details

#current_controller_matches(regex) ⇒ Object



17
18
19
# File 'app/helpers/renalware/patient_helper.rb', line 17

def current_controller_matches(regex)
  regex.match(params[:controller]).present?
end

#formatted_nhs_number(patient) ⇒ Object



21
22
23
# File 'app/helpers/renalware/patient_helper.rb', line 21

def formatted_nhs_number(patient)
  ::Renalware::PatientPresenter.new(patient).nhs_number
end

#patient_menu_item(title:, path:, active_when_controller_matches:, enabled: true) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/renalware/patient_helper.rb', line 5

def patient_menu_item(title:, path:, active_when_controller_matches:, enabled: true)
  klasses = %w(link)
  klasses << "active" if current_controller_matches(active_when_controller_matches)
   :li, class: klasses.join(" ") do
    if enabled
      link_to(title, path)
    else
       :span, title
    end
  end
end