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, #wrapper
#initialize
Instance Method Details
#call_charges_link ⇒ Object
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 45
def call_charges_link
if item[:show_uk_call_charges] == "true"
content_tag(:p) do
concat content_tag(:a,
"Find out about call charges",
class: "govuk-link",
href: "https://www.gov.uk/call-charges")
end
end
end
|
#number_list ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 18
def number_list
content_tag(:ul) do
item[:telephone_numbers].each do |number|
concat number_list_item(number)
end
end
end
|
#number_list_item(number) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 26
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_list ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 33
def opening_hours_list
content_tag(:ul) do
item[:opening_hours].each do |item|
concat opening_hours_list_item(item)
end
end
end
|
#opening_hours_list_item(item) ⇒ Object
41
42
43
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 41
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
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 10
def render
wrapper do
concat number_list
concat opening_hours_list if item[:opening_hours].present?
concat call_charges_link
end
end
|