Module: Decidim::SocialShareButtonHelper
- Defined in:
- decidim-core/app/helpers/decidim/social_share_button_helper.rb
Overview
A Helper that reimplements the SocialShareButton gem helpers, so that we don’t depend on it anymore.
Instance Method Summary collapse
- #render_social_share_button(service, title, args) ⇒ Object
- #render_social_share_buttons(services, title, args) ⇒ Object
- #social_share_button_tag(title, args) ⇒ Object
Instance Method Details
#render_social_share_button(service, title, args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'decidim-core/app/helpers/decidim/social_share_button_helper.rb', line 26 def (service, title, args) uri = service.formatted_share_uri(title, args) return unless uri = if service.icon.include? ".svg" image_tag service.icon_path, alt: t("decidim.shared.share_modal.share_to", service: service.name) else icon(service.icon, style: "color: #{service.icon_color};") end link_to( uri, rel: "nofollow", data: { site: service.name.downcase }, title: t("decidim.shared.share_modal.share_to", service: service.name) ) do + content_tag(:span, service.name) end end |
#render_social_share_buttons(services, title, args) ⇒ Object
20 21 22 23 24 |
# File 'decidim-core/app/helpers/decidim/social_share_button_helper.rb', line 20 def (services, title, args) services.map do |service| (service, title, args) end.join.html_safe end |
#social_share_button_tag(title, args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'decidim-core/app/helpers/decidim/social_share_button_helper.rb', line 6 def (title, args) return unless enabled_services.length.positive? if redesign_enabled? content_tag :div, class: "share-modal__list", data: { social_share: "" } do (enabled_services, title, args) end else content_tag :div, class: "social-share-button" do (enabled_services, title, args) end end end |