Module: Livefyre::Helpers

Defined in:
lib/livefyre/helpers.rb

Overview

View helpers for Livefyre

Instance Method Summary (collapse)

Instance Method Details

- (String) livefyre_comments(id, title, link, tags = nil, options = {})

Add a Livefyre comment form to this page.

Parameters:

  • 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) (defaults to: nil)

    Optional array or comma-delimited list of tags on this conversation.

  • options (Hash) (defaults to: {})

    Additional options to pass to the created div tag.

Returns:

  • (String)

    Returns String div element for insertion into your view



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# 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]
    }
  )
  (:div, "", options)
end