Class: ContentBlockTools::Presenters::BlockPresenters::Contact::ContactLinkPresenter

Inherits:
BasePresenter
  • Object
show all
Includes:
BlockLevelContactItem
Defined in:
lib/content_block_tools/presenters/block_presenters/contact/contact_link_presenter.rb

Constant Summary

Constants included from BlockLevelContactItem

BlockLevelContactItem::BASE_TAG_TYPE

Constants inherited from BasePresenter

BasePresenter::BASE_TAG_TYPE

Instance Attribute Summary

Attributes inherited from BasePresenter

#item

Instance Method Summary collapse

Methods included from BlockLevelContactItem

#initialize, #title, #wrapper

Methods inherited from BasePresenter

#initialize

Methods included from Govspeak

#render_govspeak

Instance Method Details

#descriptionObject



32
33
34
35
36
# File 'lib/content_block_tools/presenters/block_presenters/contact/contact_link_presenter.rb', line 32

def description
  (:li) do
    render_govspeak(item[:description])
  end
end


19
20
21
22
23
24
25
26
# File 'lib/content_block_tools/presenters/block_presenters/contact/contact_link_presenter.rb', line 19

def link
  (:li) do
    (:a,
                link_text,
                class: "url content-block__link",
                href: item[:url])
  end
end


28
29
30
# File 'lib/content_block_tools/presenters/block_presenters/contact/contact_link_presenter.rb', line 28

def link_text
  item[:label] || item[:url]
end

#renderObject



10
11
12
13
14
15
16
17
# File 'lib/content_block_tools/presenters/block_presenters/contact/contact_link_presenter.rb', line 10

def render
  wrapper do
    (:ul, class: "content-block__list") do
      concat link
      concat description if item[:description]
    end
  end
end