Sha256: 6ef5f0d15e3d8eb36a193d62ef1df07f9477e05e5603dabc7bd51e9ff46390f7

Contents?: true

Size: 637 Bytes

Versions: 35

Compression:

Stored size: 637 Bytes

Contents

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)
      content_tag :li, class: klasses.join(" ") do
        if enabled
          link_to(title, path)
        else
          content_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

35 entries across 35 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.15 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.14 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.13 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.12 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.11 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.9 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.8 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.7 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.5 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.4 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.3 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.2 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.1 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.0 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.0.pre.rc13 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.0.pre.rc11 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.0.pre.rc10 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.0.pre.rc9 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.0.pre.rc8 app/helpers/renalware/patient_helper.rb