Module: SharingTags::ActionView::ButtonHelper

Defined in:
lib/sharing_tags/action_view/button_helper.rb

Instance Method Summary collapse

Instance Method Details



19
20
21
# File 'lib/sharing_tags/action_view/button_helper.rb', line 19

def link_to_facebook_share(name_or_options = nil, &block)
  share_to name_or_options, :facebook, [:app_id, :provider, :title, :description, :caption, :image, :return_url], &block
end


31
32
33
# File 'lib/sharing_tags/action_view/button_helper.rb', line 31

def link_to_google_share(name_or_options = nil, &block)
  share_to name_or_options, :google, [], &block
end


27
28
29
# File 'lib/sharing_tags/action_view/button_helper.rb', line 27

def link_to_line_share(name_or_options = nil, &block)
  share_to name_or_options, :line, [], &block
end


43
44
45
# File 'lib/sharing_tags/action_view/button_helper.rb', line 43

def link_to_linkedin_share(name_or_options = nil, &block)
  share_to name_or_options, :linkedin, [:title, :description], &block
end


35
36
37
# File 'lib/sharing_tags/action_view/button_helper.rb', line 35

def link_to_odnoklassniki_share(name_or_options = nil, &block)
  share_to name_or_options, :odnoklassniki, [:title, :description], &block
end


39
40
41
# File 'lib/sharing_tags/action_view/button_helper.rb', line 39

def link_to_twitter_share(name_or_options = nil, &block)
  share_to name_or_options, :twitter, [:title, :description], &block
end


23
24
25
# File 'lib/sharing_tags/action_view/button_helper.rb', line 23

def link_to_vkontakte_share(name_or_options = nil, &block)
  share_to name_or_options, :vkontakte, [:title, :description, :image], &block
end

#sharing_tags_buttons(*networks, **options) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sharing_tags/action_view/button_helper.rb', line 4

def sharing_tags_buttons(*networks, **options)
  networks = SharingTags::Network.lists if networks.empty?

  # switching context
  if options[:context].present?
    SharingTags.config.switch_context(*options[:context])  do
      context =  SharingTags.config.current_context
      render template: "sharing_tags/buttons.html.slim", locals: {networks: networks, options: options, context: context}
    end
  else
    context =  SharingTags.config.current_context
    render template: "sharing_tags/buttons.html.slim", locals: {networks: networks, options: options, context: context}
  end
end