Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated async init script

  • Loading branch information...
commit 9dc4bb87edaa28d16588ef2c286fd4de070697fc 1 parent e596e33
@kristianmandrup authored
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/facebook-social_plugins/helper/script.rb
View
10 lib/facebook-social_plugins/helper/script.rb
@@ -100,8 +100,14 @@ def fb_onlogin_react options = {}, &block
def fb_async_init_script app_id, domain, options = {}
raise ArgumentError, "Not a valid Facebook App ID. It should be a 15 digit number" unless valid_facebook_id?(app_id)
raise ArgumentError, "No domain name specified" if domain.blank?
- channel = options[:channel_url] || 'assets/facebook_channel' if options[:channel] || options[:channel_url]
- channelAttrib = channel ? "channelUrl : '//#{domain}/#{channel}.html', // Channel File" : ''
+
+ if options[:channel] || options[:channel_url]
+ locale = options[:locale] || I18n.locale
+ channel = options[:channel_url] || "assets/facebook_channel_#{locale}"
+ channelAttrib = "channelUrl : '//#{domain}/#{channel}.html', // Channel File"
+ else
+ channelAttrib = '// No Facebook channel defined (use fx #fb_channel_script)'
+ end
%Q{
window.fbAsyncInit = function() {
FB.init({
Please sign in to comment.
Something went wrong with that request. Please try again.