Sha256: c0d04d5c8bbe5a2cbe37b942997461547109f9cf11be1aed57a1556bc0d37f66

Contents?: true

Size: 649 Bytes

Versions: 18

Compression:

Stored size: 649 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module PatientHelper
    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)
      tag.li(class: klasses.join(" ")) do
        if enabled
          link_to(title, path)
        else
          tag.span title
        end
      end
    end

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

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

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
renalware-core-2.1.1 app/helpers/renalware/patient_helper.rb
renalware-core-2.1.0 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.167 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.166 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.165 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.164 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.163 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.162 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.161 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.160 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.159 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.158 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.157 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.156 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.155 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.153 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.152 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.151 app/helpers/renalware/patient_helper.rb