Module: Livefyre::Helpers

Defined in:
lib/livefyre/helpers.rb

Overview

Public: View helpers for Livefyre

Instance Method Summary collapse

Instance Method Details

#livefyre_comments(id, title, link, tags = nil, options = {}) ⇒ Object

Public: Add a Livefyre comment form to this page.

id - [String, Integer] identifier to use for this conversation. Likely a post ID. title - [String] Title of this post or conversation link - [String] Link to this post or conversation tags - [Array, String] Optional array or comma-delimited list of tags on this conversation. options - [Hash] Additional options to pass to the created div tag.

Returns [String] div element for insertion into your view



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/livefyre/helpers.rb', line 14

def livefyre_comments(id, title, link, tags = nil, options = {})
  meta = (id, title, link, tags)
  options.merge!(
    :id => "livefyre_comments",
    :data => {
      :checksum => meta[:checksum],
      :"collection-meta" => meta[:collectionMeta],
      :"site-id" => meta[:siteId],
      :"article-id" => meta[:articleId],
      :network => Livefyre.client.host,
      :root => Livefyre.config[:domain],
      :"post-to-buttons" => Livefyre.config[:postToButtons]
    }
  )
  (:div, "", options)
end