Skip to content

mkurutin/facebook_share_widget_rails

 
 

Repository files navigation

Facebook Share Widget - Rails Plugin

This project rocks.

Installation

Add the gem to your Gemfile

gem 'facebook_share_widget', :git => 'https://github.com/controlshift/facebook_share_widget_rails.git'

The widget requires Facebook access token to work and the token could be provided in 2 ways:

Facebook JS SDK integration

Create an initializer in your own application and set the Facebook App ID and secret. The widget will then obtain the access token from the cookies automatically.

FacebookShareWidget.client_id = "client_id"
FacebookShareWidget.client_secret = "client_secret"

Manually specifying token in session

Create an initializer in your own application and set the session key that contains the access token. The widget will then obtain the access token from the session.

FacebookShareWidget.access_token_session_key = :facebook_access_token

Usage

Mount the plugin in routes.rb

mount FacebookShareWidget::Engine => "/widget"

On the page that embeds the widget

Add javascript and stylesheet to the head

= stylesheet_link_tag "facebook_share_widget/application"
= javascript_include_tag "facebook_share_widget/application"

Render the widget in the body

= render "/facebook_share_widget/facebook/widget"

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 96.4%
  • JavaScript 2.2%
  • CoffeeScript 1.4%