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
#email ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb', line 19
def email
content_tag(:p) do
concat content_tag(:span, item[:title])
concat content_tag(:a,
item[:email_address],
class: "email",
href: "mailto:#{item[:email_address]}#{query_params}")
end
end
|
#query_params ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'lib/content_block_tools/presenters/block_presenters/contact/email_address_presenter.rb', line 29
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(:div, class: "email-url-number") do
concat email
concat render_govspeak(item[:description]) if item[:description].present?
end
end
end
|