6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/sh_button/helper.rb', line 6
def sh_button_tag(title = "", opts = {})
opts[:allow_sites] ||= ShButton.config.allow_sites
html = []
html << "<div class='sh-button'>"
opts[:allow_sites].each do |site|
link_title = t "sh_button.share_to", name: t("sh_button.#{site.downcase}")
anchor_classes = "sh-button-item sh-button-#{site}"
anchor_classes << ' sh-button-popup' unless SH_BUTTON_NOT_POPUP.include? site
html << link_to(tag(:span, class: "sh-button-icon-#{site}"),share_link(site, title, opts[:url], opts[:image]),
class: anchor_classes, title: link_title,)
end
html << "</div>"
raw html.join("\n")
end
|