Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby JavaScript CoffeeScript CSS Shell
tree: dd429b2cbb

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
app
config
db/migrate
lib
script
spec
.gitignore
.rspec
.rvmrc
.travis.yml
Gemfile
Gemfile.lock
Guardfile
LICENSE
README.md
Rakefile
build.sh
facebook_share_widget.gemspec

README.md

Facebook Share Widget - Rails Plugin

Build Status

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"
Something went wrong with that request. Please try again.