diff --git a/facebooker2.gemspec b/facebooker2.gemspec index 8b39746..c22f7a2 100644 --- a/facebooker2.gemspec +++ b/facebooker2.gemspec @@ -1,6 +1,6 @@ spec = Gem::Specification.new do |s| s.name = 'facebooker2' - s.version = '0.0.3' + s.version = '0.0.4' s.summary = "Facebook Connect integration library for ruby and rails" s.description = "Facebook Connect integration library for ruby and rails" s.files = Dir['lib/**/*.rb'] diff --git a/lib/facebooker2/rails/helpers/facebook_connect.rb b/lib/facebooker2/rails/helpers/facebook_connect.rb index 6b0c5ad..b5e4692 100644 --- a/lib/facebooker2/rails/helpers/facebook_connect.rb +++ b/lib/facebooker2/rails/helpers/facebook_connect.rb @@ -26,6 +26,12 @@ module Facebooker2 content_tag("fb:login-button",text,options.merge(:onlogin=>js)) end + def fb_login(options = {},&proc) + js = capture(&proc) + text = options.delete(:text) + concat(content_tag("fb:login-button",text,options.merge(:onlogin=>js))) + end + # # Logs the user out of facebook and redirects to the given URL # args are passed to the call to link_to_function diff --git a/lib/facebooker2/rails/helpers/javascript.rb b/lib/facebooker2/rails/helpers/javascript.rb index a7b28fe..8c164ee 100644 --- a/lib/facebooker2/rails/helpers/javascript.rb +++ b/lib/facebooker2/rails/helpers/javascript.rb @@ -2,13 +2,13 @@ module Facebooker2 module Rails module Helpers module Javascript - def fb_connect_async_js(app_id=Facebooker2.app_id,options={}) + def fb_connect_async_js(app_id=Facebooker2.app_id,options={},&proc) opts = Hash.new(true).merge!(options) cookie = opts[:cookie] status = opts[:status] xfbml = opts[:xfbml] + extra_js = capture(&proc) if block_given? js = <<-JAVASCRIPT -
JAVASCRIPT + block_given? ? concat(js) : js end end end