Class: ContentBlockTools::Presenters::BlockPresenters::Contact::TelephonePresenter
Constant Summary
BlockLevelContactItem::BASE_TAG_TYPE
BasePresenter::BASE_TAG_TYPE
Instance Attribute Summary
#item
Instance Method Summary
collapse
#initialize, #title, #wrapper
#initialize
Methods included from Govspeak
#render_govspeak
Instance Method Details
#bsl_details ⇒ Object
51
52
53
54
55
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 51
def bsl_details
bsl_guidance = item[:bsl_guidance] || {}
render_govspeak(bsl_guidance[:value], root_class: "content-block__body") if bsl_guidance[:show]
end
|
#call_charges_link ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 67
def call_charges_link
call_charges = item[:call_charges] || {}
if call_charges[:show_call_charges_info_url]
content_tag(:p) do
concat content_tag(:a,
call_charges[:label],
class: "content-block__link",
href: call_charges[:call_charges_info_url])
end
end
end
|
#description ⇒ Object
23
24
25
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 23
def description
render_govspeak(item[:description], root_class: "content-block__body")
end
|
#number_list ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 27
def number_list
content_tag(:ul, class: "content-block__list") do
item[:telephone_numbers].each do |number|
concat number_list_item(number)
end
end
end
|
#number_list_item(number) ⇒ Object
35
36
37
38
39
40
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 35
def number_list_item(number)
content_tag(:li) do
concat content_tag(:span, "#{number[:label]}: ")
concat content_tag(:span, number[:telephone_number], { class: "tel" })
end
end
|
#opening_hours ⇒ Object
57
58
59
60
61
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 57
def opening_hours
opening_hours = item[:opening_hours] || {}
render_govspeak(opening_hours[:opening_hours], root_class: "content-block__body") if opening_hours[:show_opening_hours]
end
|
#opening_hours_list_item(item) ⇒ Object
63
64
65
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 63
def opening_hours_list_item(item)
content_tag(:li, "#{item[:day_from]} to #{item[:day_to]}, #{item[:time_from]} to #{item[:time_to]}")
end
|
#render ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 10
def render
wrapper do
content_tag(:div) do
concat description if item[:description].present?
concat number_list
concat video_relay_service
concat bsl_details
concat opening_hours
concat call_charges_link
end
end
end
|
#video_relay_service ⇒ Object
42
43
44
45
46
47
48
49
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 42
def video_relay_service
video_relay_service = item[:video_relay_service] || {}
if video_relay_service[:show]
content = "#{video_relay_service[:prefix]} #{video_relay_service[:telephone_number]}"
render_govspeak(content, root_class: "content-block__body")
end
end
|