Module: Pageflow::SocialShareLinksHelper

Includes:
SocialShareHelper
Defined in:
app/helpers/pageflow/social_share_links_helper.rb

Constant Summary collapse

PROVIDER_URL_TEMPLATES =
{
  email: 'mailto:?body=%{url}',
  facebook: 'http://www.facebook.com/sharer/sharer.php?u=%{url}',
  google: 'https://plus.google.com/share?url=%{url}',
  linked_in: 'https://www.linkedin.com/shareArticle?mini=true&url=%{url}',
  telegram: 'tg://msg?text=%{url}',
  twitter: 'https://twitter.com/intent/tweet?url=%{url}',
  whats_app: 'WhatsApp://send?text=%{url}'
}.freeze

Instance Method Summary collapse

Methods included from SocialShareHelper

#social_share_entry_description, #social_share_entry_image_tags, #social_share_entry_url, #social_share_meta_tags_for, #social_share_normalize_protocol, #social_share_page_description, #social_share_page_title, #social_share_page_url

Methods included from RevisionFileHelper

#find_file_in_entry

Methods included from PagesHelper

#page_css_class, #page_default_content, #page_has_content, #page_header, #page_media_breakpoints, #page_navigation_css_class, #page_print_image, #page_text, #page_thumbnail_file, #page_thumbnail_image_class, #page_thumbnail_url, #render_page_template, #shadow_div

Methods included from EntriesHelper

#entry_css_class, #entry_file_rights, #entry_global_links, #entry_header_css_class, #entry_mobile_navigation_pages, #entry_privacy_link_url, #entry_stylesheet_link_tag, #entry_summary, #entry_theme_stylesheet_link_tag, #pretty_entry_title, #pretty_entry_url

Instance Method Details

#share_provider_url_templatesObject



28
29
30
# File 'app/helpers/pageflow/social_share_links_helper.rb', line 28

def share_provider_url_templates
  PROVIDER_URL_TEMPLATES
end


15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/pageflow/social_share_links_helper.rb', line 15

def social_share_link(provider, entry, &block)
  block ||= ->() {}
  page_share_link_url = social_share_link_url(provider, social_share_page_url(entry, 'permaId'))
  data_attributes = entry.share_url.present? ? {} : {share_page: page_share_link_url}

  link_to(social_share_link_url(provider, social_share_entry_url(entry)),
          target: '_blank',
          tabindex: '2',
          class: ['share', provider],
          data: data_attributes,
          &block)
end