Class: ContentBlockTools::Presenters::BlockPresenters::Contact::TelephonePresenter
- Inherits:
-
BasePresenter
- Object
- BasePresenter
- ContentBlockTools::Presenters::BlockPresenters::Contact::TelephonePresenter
show all
- Defined in:
- lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb
Constant Summary
collapse
- BASE_TAG_TYPE =
:div
Instance Attribute Summary
#item
Instance Method Summary
collapse
#initialize
Instance Method Details
#call_charges_link ⇒ Object
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 43
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
16
17
18
19
20
21
22
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 16
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
24
25
26
27
28
29
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 24
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
31
32
33
34
35
36
37
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 31
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
39
40
41
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 39
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
8
9
10
11
12
13
14
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 8
def render
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
|