Module: ContentBlockTools::Presenters::BlockPresenters::Contact::BlockLevelContactItem

Included in:
AddressPresenter, ContactLinkPresenter, EmailAddressPresenter, TelephonePresenter
Defined in:
lib/content_block_tools/presenters/block_presenters/contact/block_level_contact_item.rb

Constant Summary collapse

BASE_TAG_TYPE =
:div

Instance Method Summary collapse

Instance Method Details

#initialize(item, content_block:, rendering_context: :block, **_args) ⇒ Object



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

def initialize(item, content_block:, rendering_context: :block, **_args)
  @item = item
  @content_block = content_block
  @rendering_context = rendering_context
end

#titleObject



25
26
27
28
29
# File 'lib/content_block_tools/presenters/block_presenters/contact/block_level_contact_item.rb', line 25

def title
  (:p,
              @content_block.title,
              class: "govuk-!-margin-bottom-3")
end

#wrapper(&block) ⇒ Object



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

def wrapper(&block)
  if @rendering_context == :field_names
    (:div, class: "contact") do
      concat title if show_title_in_field_names_context?
      concat yield block
    end
  else
    yield block
  end
end