Class: ContentBlockTools::Presenters::BlockPresenters::Contact::TelephonePresenter

Inherits:
BasePresenter
  • Object
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

Attributes inherited from BasePresenter

#item

Instance Method Summary collapse

Methods inherited from BasePresenter

#initialize, #title_content

Constructor Details

This class inherits a constructor from ContentBlockTools::Presenters::BlockPresenters::BasePresenter

Instance Method Details



27
28
29
30
31
32
33
34
35
36
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 27

def call_charges_link
  if item[:show_uk_call_charges] == "true"
    (:p, class: "govuk-!-margin-0") do
      concat (:a,
                         "Find out about call charges",
                         class: "govuk-link",
                         href: "https://www.gov.uk/call-charges")
    end
  end
end

#number_listObject



15
16
17
18
19
20
21
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 15

def number_list
  (: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



23
24
25
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 23

def number_list_item(number)
  (:li, "#{number[:label]}: #{number[:telephone_number]}", class: "govuk-!-margin-bottom-0")
end

#renderObject



8
9
10
11
12
13
# File 'lib/content_block_tools/presenters/block_presenters/contact/telephone_presenter.rb', line 8

def render
  (:div, class: "govuk-body") do
    concat number_list
    concat call_charges_link
  end
end