Class: Renalware::Medications::TabbedPrescriptionsListComponent
- Inherits:
-
ApplicationComponent
- Object
- ViewComponent::Base
- ApplicationComponent
- Renalware::Medications::TabbedPrescriptionsListComponent
- 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
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
Instance Method Summary collapse
-
#initialize(prescription_groups) ⇒ TabbedPrescriptionsListComponent
constructor
Map the incoming array of hashes to an array of PrescriptionGroup objects to make interrogation easier in the html.
Methods included from DrugsHelper
#drug_select_options, #drug_types_colour_tag, #drug_types_tag
Methods inherited from ApplicationComponent
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 { || PrescriptionGroup.new() } super end |
Instance Attribute Details
#groups ⇒ Object (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 |