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



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

def title
  if @rendering_context == :field_names
    (:p,
                @content_block.title,
                class: "content-block__title")
  else
    (:p, item[:title], class: "content-block__subtitle")
  end
end

#wrapper(&block) ⇒ Object



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

def wrapper(&block)
  (:div) do
    concat title
    concat yield block
  end
end