Class: ContentBlockTools::Presenters::BlockPresenters::Contact::EmailAddressPresenter
Constant Summary
BlockLevelContactItem::BASE_TAG_TYPE
BasePresenter::BASE_TAG_TYPE
Instance Attribute Summary
#item
Instance Method Summary
collapse
#initialize, #title, #wrapper
#initialize
Methods included from Govspeak
#render_govspeak
Instance Method Details
#description ⇒ Object
41
42
43
44
45
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb', line 41
def description
content_tag(:li) do
render_govspeak(item[:description])
end
end
|
#email ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb', line 19
def email
content_tag(:li) do
concat content_tag(:a,
link_text,
class: "email content-block__link",
href: "mailto:#{item[:email_address]}#{query_params}")
end
end
|
#link_text ⇒ Object
37
38
39
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb', line 37
def link_text
item[:label] || item[:email_address]
end
|
#query_params ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb', line 28
def query_params
params = {
subject: item[:subject],
body: item[:body],
}.compact.map { |k, v| "#{k}=#{v}" }.join("&")
"?#{params}" if params.present?
end
|
#render ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb', line 10
def render
wrapper do
content_tag(:ul, class: "content-block__list") do
concat email
concat description if item[:description].present?
end
end
end
|