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
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 47
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
20
21
22
23
24
25
26
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 20
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
28
29
30
31
32
33
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 28
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
35
36
37
38
39
40
41
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 35
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
43
44
45
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 43
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
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 10
def render
wrapper do
content_tag(:div, class: "email-url-number") do
concat number_list
concat opening_hours_list if item[:opening_hours].present?
concat call_charges_link
end
end
end
|