Sha256: 29c1085eda5de716da7fadf15f1147db9afdd481dfe11b28fa099a8188b95dfd

Contents?: true

Size: 668 Bytes

Versions: 124

Compression:

Stored size: 668 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)
      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

124 entries across 124 versions & 1 rubygems

Version Path
renalware-core-2.0.149 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.148 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.147 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.146 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.145 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.144 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.143 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.142 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.141 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.140 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.139 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.138 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.137 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.136 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.135 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.134 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.133 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.132 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.131 app/helpers/renalware/patient_helper.rb
renalware-core-2.0.130 app/helpers/renalware/patient_helper.rb