facebooker2 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,12 @@ module Facebooker2
26
26
  content_tag("fb:login-button",text,options.merge(:onlogin=>js))
27
27
  end
28
28
 
29
+ def fb_login(url, options = {},&proc)
30
+ js = concat(&proc)
31
+ text = options.delete(:text)
32
+ content_tag("fb:login-button",text,options.merge(:onlogin=>js))
33
+ end
34
+
29
35
  #
30
36
  # Logs the user out of facebook and redirects to the given URL
31
37
  # args are passed to the call to link_to_function
@@ -2,11 +2,12 @@ module Facebooker2
2
2
  module Rails
3
3
  module Helpers
4
4
  module Javascript
5
- def fb_connect_async_js(app_id=Facebooker2.app_id,options={})
5
+ def fb_connect_async_js(app_id=Facebooker2.app_id,options={},&proc)
6
6
  opts = Hash.new(true).merge!(options)
7
7
  cookie = opts[:cookie]
8
8
  status = opts[:status]
9
9
  xfbml = opts[:xfbml]
10
+ extra_js = capture(&proc) if block_given?
10
11
  js = <<-JAVASCRIPT
11
12
  <div id="fb-root"></div>
12
13
  <script>
@@ -17,6 +18,7 @@ module Facebooker2
17
18
  cookie : #{cookie}, // enable cookies to allow the server to access the session
18
19
  xfbml : #{xfbml} // parse XFBML
19
20
  });
21
+ #{extra_js}
20
22
  };
21
23
 
22
24
  (function() {
@@ -27,6 +29,7 @@ module Facebooker2
27
29
  }());
28
30
  </script>
29
31
  JAVASCRIPT
32
+ block_given? ? concat(js) : js
30
33
  end
31
34
  end
32
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facebooker2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Mangino
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-05-11 00:00:00 -04:00
12
+ date: 2010-05-13 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency