Sha256: ca7feb68b0b70a2bd6c2f758ca2608e4c019b29eff5be09e58fbc2128a954bc7

Contents?: true

Size: 996 Bytes

Versions: 13

Compression:

Stored size: 996 Bytes

Contents

module Juli::Visitor::Html::Helper
  # Helper-class for 'fb_like' helper
  class FbLike < AbstractHelper
    # default HTML template for facebook 'like' button.
    # You can customize it in .juli/config facebook.like.template entry.
    #
    # %{href} in the template will be replaced to the actual URL of
    # current wiki page.
    DEFAULT_TEMPLATE =
      '<fb:like href="%{href}" ' +
          'send="false" layout="button_count" width="450" ' +
          'show_faces="false">' +
          '</fb:like>'

    def initialize
      @fb_conf  = conf['facebook']
    end

    # called on each parsed document
    def on_root(in_file, root, visitor = nil)
      @in_file  = in_file
    end

    def run(*args)
      raise Juli::NoConfig if !conf['url_prefix']
      raise Juli::NoConfig if !@in_file

      template.gsub('%{href}',
          conf['url_prefix'] + '/' + to_wikiname(@in_file) + conf['ext'])
    end

  private
    def template
      @fb_conf['like']['template']
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
juli-2.3.2 lib/juli/visitor/html/helper/fb_like.rb
juli-2.3.1 lib/juli/visitor/html/helper/fb_like.rb
juli-2.3.0 lib/juli/visitor/html/helper/fb_like.rb
juli-2.2.4 lib/juli/visitor/html/helper/fb_like.rb
juli-2.2.3 lib/juli/visitor/html/helper/fb_like.rb
juli-2.2.1 lib/juli/visitor/html/helper/fb_like.rb
juli-2.2.0 lib/juli/visitor/html/helper/fb_like.rb
juli-2.1.0 lib/juli/visitor/html/helper/fb_like.rb
juli-2.0.4 lib/juli/visitor/html/helper/fb_like.rb
juli-2.0.3 lib/juli/visitor/html/helper/fb_like.rb
juli-2.0.2 lib/juli/visitor/html/helper/fb_like.rb
juli-2.0.1 lib/juli/visitor/html/helper/fb_like.rb
juli-2.0.0 lib/juli/visitor/html/helper/fb_like.rb