Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major refactoring and improved script apis - bumped version
- Loading branch information
1 parent
6fb840c
commit a22b7ef
Showing
29 changed files
with
267 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.3 | ||
0.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,38 @@ | ||
require 'facebook-social_plugins/button' | ||
module FacebookSocialPlugins | ||
module Helper | ||
end | ||
|
||
require 'facebook-social_plugins/analytics' | ||
require 'facebook-social_plugins/open_graph/meta_helper' | ||
module Plugin | ||
end | ||
|
||
module FacebookSocialPlugins | ||
def self.plugins | ||
['activity_feed', 'add_to_timeline', 'comments', 'facepile', 'like_box', 'like_button', | ||
'live_stream', 'login_button', 'recommendations_box', 'registration', 'send_button', 'subscribe_button'] | ||
[ | ||
'activity_feed', 'add_to_timeline', 'comments', 'facepile', | ||
'like_box', 'like_button', 'live_stream', 'login_button', 'recommendations_box', | ||
'registration', 'send_button', 'subscribe_button' | ||
] | ||
end | ||
|
||
def self.all_plugins | ||
['ui_helper', 'social', 'button'] + plugins | ||
end | ||
|
||
def self.helpers | ||
['script', 'view'] | ||
['script', 'view', 'open_graph'] | ||
end | ||
|
||
def self.plugin name, options | ||
klass = "FacebookSocialPlugins::Plugin::#{name.to_s.camelize}".constantize | ||
klass.new(options).render | ||
end | ||
end | ||
|
||
FacebookSocialPlugins.plugins.each do |name| | ||
require "facebook-social_plugins/#{name}" | ||
FacebookSocialPlugins.all_plugins.each do |name| | ||
require "facebook-social_plugins/plugin/#{name}" | ||
end | ||
|
||
FacebookSocialPlugins.helpers.each do |name| | ||
require "facebook-social_plugins/#{name}_helper" | ||
require "facebook-social_plugins/helper/#{name}" | ||
end | ||
|
||
require 'facebook-social_plugins/rails/engine' if defined?(::Rails::Engine) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
module FacebookSocialPlugins::Helper | ||
module OpenGraph | ||
def og_header name, namespace, &block | ||
content = capture(&block) | ||
content_tag :head, content, :prefix => "og: http://ogp.me/ns# og_#{name}: http://ogp.me/ns/apps/#{namespace}x#" | ||
end | ||
|
||
def fb_app_id app_id | ||
content_tag :meta, '', :property => "fb:app_id", :content => app_id | ||
end | ||
|
||
def og_type namespace, object_type | ||
content_tag :meta, '', :property => "og:type", :content => "#{namespace}:#{object_type}" | ||
end | ||
|
||
def og_title title | ||
content_tag :meta, '', :property => "og:title", :content => title | ||
end | ||
|
||
def og_image href | ||
content_tag :meta, '', :property => "og:image", :content => href | ||
end | ||
|
||
def og_desc desc | ||
content_tag :meta, '', :property => "og:description", :content => desc | ||
end | ||
|
||
def og_url href | ||
content_tag :meta, '', :property => "og:url", :content => href | ||
end | ||
|
||
def open_graph_meta name, namespace, app_id, object_type, options = {} | ||
content = fb_app_id(app_id) + og_type(namespace, object_type) | ||
content << og_title(options[:title]) if options[:title] | ||
content << og_image(options[:img]) if options[:img] | ||
content << og_image(options[:desc]) if options[:desc] | ||
content << og_image(options[:url]) if options[:url] | ||
og_header(name, namespace) do | ||
content | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.