Sha256: 77961dba3b7c21a4bd7995c810e3be3bde8955e19e7d750bd94789398e9f16ff

Contents?: true

Size: 910 Bytes

Versions: 35

Compression:

Stored size: 910 Bytes

Contents

require_dependency "renalware"

module Renalware
  module PrimaryCarePhysiciansHelper
    def practices_options_for_select(primary_care_physician)
      selected_ids = primary_care_physician.practices.map(&:id)
      options_from_collection_for_select(Patients::Practice.all, :id, :name, selected_ids)
    end

    def practices_or_address(primary_care_physician)
      if primary_care_physician.practices.any?
        return practices_list(primary_care_physician.practices)
      end
      if primary_care_physician.address.present?
        return format_address(primary_care_physician.address)
      end
    end

    private

    def format_address(address)
      AddressPresenter::Short.new(address)
    end

    def practices_list(practices)
      practice_links = practices.map { |p| link_to(p.name, "#", title: format_address(p.address)) }
      practice_links.join(tag(:br)).html_safe
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

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