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, #title_content
Instance Method Details
#call_charges_link ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 40
def call_charges_link
if item[:show_uk_call_charges] == "true"
content_tag(:p, class: "govuk-!-margin-0") 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, class: "govuk-!-padding-0 govuk-!-margin-0 govuk-list") do
item[:telephone_numbers].each do |number|
concat number_list_item(number)
end
end
end
|
#number_list_item(number) ⇒ Object
24
25
26
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 24
def number_list_item(number)
content_tag(:li, "#{number[:label]}: #{number[:telephone_number]}", class: "govuk-!-margin-bottom-0")
end
|
#opening_hours_list ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 28
def opening_hours_list
content_tag(:ul, class: "govuk-!-padding-0 govuk-!-margin-0 govuk-list") do
item[:opening_hours].each do |item|
concat opening_hours_list_item(item)
end
end
end
|
#opening_hours_list_item(item) ⇒ Object
36
37
38
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 36
def opening_hours_list_item(item)
content_tag(:li, "#{item[:day_from]} to #{item[:day_to]}, #{item[:time_from]} to #{item[:time_to]}", class: "govuk-!-margin-bottom-0")
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: "govuk-body") do
concat number_list
concat opening_hours_list if item[:opening_hours].any?
concat call_charges_link
end
end
|