Class: Renalware::Medications::TabbedPrescriptionsListComponent

Inherits:
ApplicationComponent
  • Object
show all
Includes:
DrugsHelper
Defined in:
app/components/renalware/medications/tabbed_prescriptions_list_component.rb

Overview

Accepts a group of prescriptions - see example usage - and renders a tabs for each of the group names with their corresponding tablular content. Various options - see PrescriptionGroup - drive what columns are shown.

Example usage:

render Renalware::Medications::TabbedPrescriptionsListComponent.new(

[
   { title: "Current", prescriptions: list1, show_administer_on_hd: true },
   { title: "EPO", prescriptions: list2, show_terminated_on: true }
]

Defined Under Namespace

Classes: PrescriptionGroup

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DrugsHelper

#drug_select_options, #drug_types_colour_tag, #drug_types_tag

Methods inherited from ApplicationComponent

#policy, #renalware

Constructor Details

#initialize(prescription_groups) ⇒ TabbedPrescriptionsListComponent

Map the incoming array of hashes to an array of PrescriptionGroup objects to make interrogation easier in the html.



41
42
43
44
# File 'app/components/renalware/medications/tabbed_prescriptions_list_component.rb', line 41

def initialize(prescription_groups)
  @groups = Array(prescription_groups).map { |options| PrescriptionGroup.new(options) }
  super
end

Instance Attribute Details

#groupsObject (readonly)

Returns the value of attribute groups.



18
19
20
# File 'app/components/renalware/medications/tabbed_prescriptions_list_component.rb', line 18

def groups
  @groups
end