facebooker2 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,4 @@
1
1
  require "digest/md5"
2
- require "ruby-debug"
3
2
  module Facebooker2
4
3
  module Rails
5
4
  module Controller
@@ -70,4 +69,4 @@ module Facebooker2
70
69
  end
71
70
  end
72
71
  end
73
- end
72
+ end
@@ -0,0 +1,33 @@
1
+ module Facebooker2
2
+ module Rails
3
+ module Helpers
4
+ module RequestForms
5
+ def fb_req_choice(label,url)
6
+ tag "fb:req-choice",:label=>label,:url=>url
7
+ end
8
+
9
+ def fb_multi_friend_selector(message,options={},&block)
10
+ options = fb_stringify_vals({:showborder=>false,:actiontext=>message,:max=>20}.merge(options.dup))
11
+ tag("fb:multi-friend-selector",options)
12
+ end
13
+
14
+ def fb_request_form(type,url,message,options={},&block)
15
+ content = capture(&block)
16
+ concat(content_tag("fb:request-form", content.to_s + fb_forgery_protection_token_tag,
17
+ {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>message}.merge(options)))
18
+ end
19
+
20
+
21
+ def fb_forgery_protection_token_tag
22
+ unless protect_against_forgery?
23
+ ''
24
+ else
25
+ tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token)
26
+ end
27
+ end
28
+
29
+
30
+ end
31
+ end
32
+ end
33
+ end
@@ -42,27 +42,6 @@ module Facebooker2
42
42
  end
43
43
  end
44
44
 
45
- def fb_stringify_vals(hash)
46
- result={}
47
- hash.each do |key,value|
48
- result[key]=value.to_s
49
- end
50
- result
51
- end
52
- def fb_transform_keys(options,transformation_hash)
53
- new_hash = {}
54
- options.each do |key,value|
55
- new_key = transformation_hash[key]||key
56
- new_hash[new_key]=value
57
- end
58
- new_hash
59
- end
60
- FB_ALWAYS_VALID_OPTION_KEYS = [:class, :style]
61
-
62
- def fb_assert_valid_keys(options,*valid_keys)
63
- unknown_keys = options.keys - [valid_keys + FB_ALWAYS_VALID_OPTION_KEYS].flatten
64
- raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
65
- end
66
45
 
67
46
  end
68
47
  end
@@ -3,7 +3,31 @@ module Facebooker2
3
3
  module Helpers
4
4
  include FacebookConnect
5
5
  include Javascript
6
+ include RequestForms
6
7
  include User
8
+
9
+ def fb_stringify_vals(hash)
10
+ result={}
11
+ hash.each do |key,value|
12
+ result[key]=value.to_s
13
+ end
14
+ result
15
+ end
16
+ def fb_transform_keys(options,transformation_hash)
17
+ new_hash = {}
18
+ options.each do |key,value|
19
+ new_key = transformation_hash[key]||key
20
+ new_hash[new_key]=value
21
+ end
22
+ new_hash
23
+ end
24
+ FB_ALWAYS_VALID_OPTION_KEYS = [:class, :style]
25
+
26
+ def fb_assert_valid_keys(options,*valid_keys)
27
+ unknown_keys = options.keys - [valid_keys + FB_ALWAYS_VALID_OPTION_KEYS].flatten
28
+ raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
29
+ end
30
+
7
31
  end
8
32
  end
9
33
  end
data/lib/facebooker2.rb CHANGED
@@ -46,5 +46,6 @@ end
46
46
  require "facebooker2/rails/controller"
47
47
  require "facebooker2/rails/helpers/facebook_connect"
48
48
  require "facebooker2/rails/helpers/javascript"
49
+ require "facebooker2/rails/helpers/request_forms"
49
50
  require "facebooker2/rails/helpers/user"
50
51
  require "facebooker2/rails/helpers"
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.2
4
+ version: 0.0.3
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-06 00:00:00 -04:00
12
+ date: 2010-05-11 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -34,6 +34,7 @@ files:
34
34
  - lib/facebooker2/rails/controller.rb
35
35
  - lib/facebooker2/rails/helpers/facebook_connect.rb
36
36
  - lib/facebooker2/rails/helpers/javascript.rb
37
+ - lib/facebooker2/rails/helpers/request_forms.rb
37
38
  - lib/facebooker2/rails/helpers/user.rb
38
39
  - lib/facebooker2/rails/helpers.rb
39
40
  - lib/facebooker2/rails.rb