-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathparents_helper.rb
More file actions
30 lines (27 loc) · 830 Bytes
/
parents_helper.rb
File metadata and controls
30 lines (27 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true
module ParentsHelper
def format_parents_with_relationships(parent_relationships)
tag.ul(class: "nhsuk-list") do
safe_join(
parent_relationships.map do |parent_relationship|
tag.li { format_parent_with_relationship(parent_relationship) }
end
)
end
end
def format_parent_with_relationship(parent_relationship, include_phone: true)
parent = parent_relationship.parent
safe_join(
[
parent_relationship.label_with_parent,
if (email = parent.email).present?
tag.span(email, class: "nhsuk-u-secondary-text-colour")
end,
if include_phone && (phone = parent.phone).present?
tag.span(phone, class: "nhsuk-u-secondary-text-colour")
end
].compact,
tag.br
)
end
end