mmangino-facebooker 1.0.15 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +27 -16
- data/Rakefile +1 -1
- data/generators/facebook/templates/public/javascripts/facebooker.js +1 -8
- data/init.rb +3 -1
- data/lib/facebooker.rb +2 -1
- data/lib/facebooker/adapters/facebook_adapter.rb +4 -0
- data/lib/facebooker/mock/service.rb +50 -0
- data/lib/facebooker/mock/session.rb +18 -0
- data/lib/facebooker/model.rb +2 -2
- data/lib/facebooker/models/applicationrestrictions.rb +10 -0
- data/lib/facebooker/models/user.rb +33 -1
- data/lib/facebooker/models/video.rb +9 -0
- data/lib/facebooker/parser.rb +8 -1
- data/lib/facebooker/rails/controller.rb +15 -3
- data/lib/facebooker/rails/cucumber.rb +30 -0
- data/lib/facebooker/rails/cucumber/world.rb +46 -0
- data/lib/facebooker/rails/helpers.rb +203 -122
- data/lib/facebooker/rails/helpers/fb_connect.rb +25 -3
- data/lib/facebooker/rails/integration_session.rb +40 -0
- data/lib/facebooker/rails/publisher.rb +15 -2
- data/lib/facebooker/rails/test_helpers.rb +11 -26
- data/lib/facebooker/service.rb +6 -3
- data/lib/facebooker/session.rb +19 -1
- data/lib/tasks/tunnel.rake +2 -2
- data/test/{adapters_test.rb → facebooker/adapters_test.rb} +2 -4
- data/test/{facebook_admin_test.rb → facebooker/admin_test.rb} +2 -2
- data/test/{batch_request_test.rb → facebooker/batch_request_test.rb} +3 -2
- data/test/{facebook_data_test.rb → facebooker/data_test.rb} +2 -2
- data/test/{logging_test.rb → facebooker/logging_test.rb} +3 -3
- data/test/{model_test.rb → facebooker/model_test.rb} +2 -4
- data/test/{event_test.rb → facebooker/models/event_test.rb} +2 -2
- data/test/{user_test.rb → facebooker/models/user_test.rb} +10 -5
- data/test/{publisher_test.rb → facebooker/rails/publisher_test.rb} +12 -18
- data/test/{rails_integration_test.rb → facebooker/rails_integration_test.rb} +126 -115
- data/test/{facebook_cache_test.rb → facebooker/server_cache_test.rb} +1 -1
- data/test/{session_test.rb → facebooker/session_test.rb} +3 -2
- data/test/facebooker_test.rb +19 -1
- data/test/{http_multipart_post_test.rb → net/http_multipart_post_test.rb} +2 -4
- data/test/rails_test_helper.rb +11 -0
- data/test/test_helper.rb +2 -2
- metadata +28 -17
- data/lib/facebooker/rails/facebook_asset_path.rb +0 -18
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'action_pack'
|
1
2
|
module Facebooker
|
2
3
|
module Rails
|
3
4
|
|
@@ -15,7 +16,11 @@ module Facebooker
|
|
15
16
|
# cancel_button is true or false
|
16
17
|
def fb_dialog( id, cancel_button, &block )
|
17
18
|
content = capture(&block)
|
18
|
-
|
19
|
+
if ignore_binding?
|
20
|
+
concat( content_tag("fb:dialog", content, {:id => id, :cancel_button => cancel_button}) )
|
21
|
+
else
|
22
|
+
concat( content_tag("fb:dialog", content, {:id => id, :cancel_button => cancel_button}), block.binding )
|
23
|
+
end
|
19
24
|
end
|
20
25
|
|
21
26
|
def fb_dialog_title( title )
|
@@ -23,8 +28,12 @@ module Facebooker
|
|
23
28
|
end
|
24
29
|
|
25
30
|
def fb_dialog_content( &block )
|
26
|
-
content = capture(&block)
|
27
|
-
|
31
|
+
content = capture(&block)
|
32
|
+
if ignore_binding?
|
33
|
+
concat( content_tag("fb:dialog-content", content) )
|
34
|
+
else
|
35
|
+
concat( content_tag("fb:dialog-content", content), block.binding )
|
36
|
+
end
|
28
37
|
end
|
29
38
|
|
30
39
|
def fb_dialog_button( type, value, options={} )
|
@@ -52,27 +61,32 @@ module Facebooker
|
|
52
61
|
# <% end %>
|
53
62
|
def fb_request_form(type,message_param,url,options={},&block)
|
54
63
|
content = capture(&block)
|
55
|
-
message = @template.instance_variable_get("@content_for_#{message_param}")
|
56
|
-
|
57
|
-
|
58
|
-
|
64
|
+
message = @template.instance_variable_get("@content_for_#{message_param}")
|
65
|
+
if ignore_binding?
|
66
|
+
concat(content_tag("fb:request-form", content + token_tag,
|
67
|
+
{:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>message}.merge(options)))
|
68
|
+
else
|
69
|
+
concat(content_tag("fb:request-form", content + token_tag,
|
70
|
+
{:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>message}.merge(options)),
|
71
|
+
block.binding)
|
72
|
+
end
|
59
73
|
end
|
60
74
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
75
|
+
# Create a submit button for an <fb:request-form>
|
76
|
+
# If the request is for an individual user you can optionally
|
77
|
+
# Provide the user and a label for the request button.
|
78
|
+
# For example
|
79
|
+
# <% content_for("invite_user") do %>
|
80
|
+
# This gets sent in the invite. <%= fb_req_choice("Come join us!",new_invite_path) %>
|
81
|
+
# <% end %>
|
82
|
+
# <% fb_request_form("Invite","invite_user",create_invite_path) do %>
|
83
|
+
# Invite <%= fb_name(@facebook_user.friends.first.id)%> to the party <br />
|
84
|
+
# <%= fb_request_form_submit(:uid => @facebook_user.friends.first.id, :label => "Invite %n") %>
|
85
|
+
# <% end %>
|
86
|
+
# <em>See:</em> http://wiki.developers.facebook.com/index.php/Fb:request-form-submit for options
|
87
|
+
def fb_request_form_submit(options={})
|
88
|
+
tag("fb:request-form-submit",stringify_vals(options))
|
89
|
+
end
|
76
90
|
|
77
91
|
|
78
92
|
# Create an fb:request-form with an fb_multi_friend_selector inside
|
@@ -86,11 +100,18 @@ module Facebooker
|
|
86
100
|
# <% end %>
|
87
101
|
def fb_multi_friend_request(type,friend_selector_message,url,&block)
|
88
102
|
content = capture(&block)
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
103
|
+
if ignore_binding?
|
104
|
+
concat(content_tag("fb:request-form",
|
105
|
+
fb_multi_friend_selector(friend_selector_message) + token_tag,
|
106
|
+
{:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>content}
|
107
|
+
))
|
108
|
+
else
|
109
|
+
concat(content_tag("fb:request-form",
|
110
|
+
fb_multi_friend_selector(friend_selector_message) + token_tag,
|
111
|
+
{:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>content}
|
112
|
+
),
|
113
|
+
block.binding)
|
114
|
+
end
|
94
115
|
end
|
95
116
|
|
96
117
|
# Render an <fb:friend-selector> element
|
@@ -130,45 +151,45 @@ module Facebooker
|
|
130
151
|
def fb_req_choice(label,url)
|
131
152
|
tag "fb:req-choice",:label=>label,:url=>url
|
132
153
|
end
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
154
|
+
|
155
|
+
# Create a facebook form using <fb:editor>
|
156
|
+
#
|
157
|
+
# It yields a form builder that will convert the standard rails form helpers
|
158
|
+
# into the facebook specific version.
|
159
|
+
#
|
160
|
+
# Example:
|
161
|
+
# <% facebook_form_for(:poke,@poke,:url => create_poke_path) do |f| %>
|
162
|
+
# <%= f.text_field :message, :label=>"message" %>
|
163
|
+
# <%= f.buttons "Save Poke" %>
|
164
|
+
# <% end %>
|
165
|
+
#
|
166
|
+
# will generate
|
167
|
+
#
|
168
|
+
# <fb:editor action="/pokes/create">
|
169
|
+
# <fb:editor-text name="poke[message]" id="poke_message" value="" label="message" />
|
170
|
+
# <fb:editor-buttonset>
|
171
|
+
# <fb:editor-button label="Save Poke"
|
172
|
+
# </fb:editor-buttonset>
|
173
|
+
# </fb:editor>
|
153
174
|
def facebook_form_for( record_or_name_or_array,*args, &proc)
|
154
175
|
|
155
176
|
raise ArgumentError, "Missing block" unless block_given?
|
156
177
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
157
178
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
179
|
+
case record_or_name_or_array
|
180
|
+
when String, Symbol
|
181
|
+
object_name = record_or_name_or_array
|
182
|
+
when Array
|
183
|
+
object = record_or_name_or_array.last
|
184
|
+
object_name = ActionController::RecordIdentifier.singular_class_name(object)
|
185
|
+
apply_form_for_options!(record_or_name_or_array, options)
|
186
|
+
args.unshift object
|
187
|
+
else
|
188
|
+
object = record_or_name_or_array
|
189
|
+
object_name = ActionController::RecordIdentifier.singular_class_name(object)
|
190
|
+
apply_form_for_options!([object], options)
|
191
|
+
args.unshift object
|
192
|
+
end
|
172
193
|
method = (options[:html]||{})[:method]
|
173
194
|
options[:builder] ||= Facebooker::Rails::FacebookFormBuilder
|
174
195
|
editor_options={}
|
@@ -180,12 +201,20 @@ module Facebooker
|
|
180
201
|
width=options.delete(:labelwidth)
|
181
202
|
editor_options[:labelwidth]=width unless width.blank?
|
182
203
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
204
|
+
if ignore_binding?
|
205
|
+
concat(tag("fb:editor",editor_options,true))
|
206
|
+
concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false)) unless method.blank?
|
207
|
+
concat(token_tag)
|
208
|
+
fields_for( object_name,*(args << options), &proc)
|
209
|
+
concat("</fb:editor>")
|
210
|
+
else
|
211
|
+
concat(tag("fb:editor",editor_options,true) , proc.binding)
|
212
|
+
concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?
|
213
|
+
concat(token_tag, proc.binding)
|
214
|
+
fields_for( object_name,*(args << options), &proc)
|
215
|
+
concat("</fb:editor>",proc.binding)
|
216
|
+
end
|
217
|
+
end
|
189
218
|
|
190
219
|
# Render an fb:name tag for the given user
|
191
220
|
# This renders the name of the user specified. You can use this tag as both subject and object of
|
@@ -284,17 +313,21 @@ module Facebooker
|
|
284
313
|
VALID_FB_SHARED_PHOTO_SIZES = [:thumb, :small, :normal, :square]
|
285
314
|
VALID_FB_PHOTO_SIZES = VALID_FB_SHARED_PHOTO_SIZES
|
286
315
|
VALID_FB_PROFILE_PIC_SIZES = VALID_FB_SHARED_PHOTO_SIZES
|
287
|
-
VALID_PERMISSIONS=[:email, :offline_access, :status_update, :photo_upload, :create_listing, :create_event, :rsvp_event, :sms]
|
316
|
+
VALID_PERMISSIONS=[:email, :offline_access, :status_update, :photo_upload, :create_listing, :create_event, :rsvp_event, :sms, :video_upload]
|
288
317
|
|
289
318
|
# Render an fb:tabs tag containing some number of fb:tab_item tags.
|
290
319
|
# Example:
|
291
|
-
# <% fb_tabs do %>
|
292
|
-
|
293
|
-
|
294
|
-
|
320
|
+
# <% fb_tabs do %>
|
321
|
+
# <%= fb_tab_item("Home", "home") %>
|
322
|
+
# <%= fb_tab_item("Office", "office") %>
|
323
|
+
# <% end %>
|
295
324
|
def fb_tabs(&block)
|
296
|
-
content = capture(&block)
|
297
|
-
|
325
|
+
content = capture(&block)
|
326
|
+
if ignore_binding?
|
327
|
+
concat(content_tag("fb:tabs", content))
|
328
|
+
else
|
329
|
+
concat(content_tag("fb:tabs", content), block.binding)
|
330
|
+
end
|
298
331
|
end
|
299
332
|
|
300
333
|
# Render an fb:tab_item tag.
|
@@ -304,7 +337,7 @@ module Facebooker
|
|
304
337
|
def fb_tab_item(title, url, options={})
|
305
338
|
options= options.dup
|
306
339
|
options.assert_valid_keys(FB_TAB_ITEM_VALID_OPTION_KEYS)
|
307
|
-
options.merge!(:title => title, :href => url)
|
340
|
+
options.merge!(:title => title, :href => url)
|
308
341
|
validate_fb_tab_item_align_value(options)
|
309
342
|
tag("fb:tab-item", stringify_vals(options))
|
310
343
|
end
|
@@ -313,13 +346,13 @@ module Facebooker
|
|
313
346
|
|
314
347
|
def validate_fb_tab_item_align_value(options)
|
315
348
|
if options.has_key?(:align) && !VALID_FB_TAB_ITEM_ALIGN_VALUES.include?(options[:align].to_sym)
|
316
|
-
raise(ArgumentError, "
|
349
|
+
raise(ArgumentError, "Unknown value for align: #{options[:align]}")
|
317
350
|
end
|
318
351
|
end
|
319
352
|
|
320
353
|
def validate_fb_photo_align_value(options)
|
321
354
|
if options.has_key?(:align) && !VALID_FB_PHOTO_ALIGN_VALUES.include?(options[:align].to_sym)
|
322
|
-
raise(ArgumentError, "
|
355
|
+
raise(ArgumentError, "Unknown value for align: #{options[:align]}")
|
323
356
|
end
|
324
357
|
end
|
325
358
|
|
@@ -336,8 +369,12 @@ module Facebooker
|
|
336
369
|
# <%= fb_wall_post(@otheruser,"This is another message") %>
|
337
370
|
# <% end %>
|
338
371
|
def fb_wall(&proc)
|
339
|
-
content = capture(&proc)
|
340
|
-
|
372
|
+
content = capture(&proc)
|
373
|
+
if ignore_binding?
|
374
|
+
concat(content_tag("fb:wall",content,{}))
|
375
|
+
else
|
376
|
+
concat(content_tag("fb:wall",content,{}),proc.binding)
|
377
|
+
end
|
341
378
|
end
|
342
379
|
|
343
380
|
# Render an <fb:wallpost> tag
|
@@ -396,8 +433,12 @@ module Facebooker
|
|
396
433
|
# <% end %>
|
397
434
|
def fb_dashboard(&proc)
|
398
435
|
if block_given?
|
399
|
-
content = capture(&proc)
|
400
|
-
|
436
|
+
content = capture(&proc)
|
437
|
+
if ignore_binding?
|
438
|
+
concat(content_tag("fb:dashboard",content,{}))
|
439
|
+
else
|
440
|
+
concat(content_tag("fb:dashboard",content,{}),proc.binding)
|
441
|
+
end
|
401
442
|
else
|
402
443
|
content_tag("fb:dashboard",content,{})
|
403
444
|
end
|
@@ -406,13 +447,21 @@ module Facebooker
|
|
406
447
|
# Content for the wide profile box goes in this tag
|
407
448
|
def fb_wide(&proc)
|
408
449
|
content = capture(&proc)
|
409
|
-
|
450
|
+
if ignore_binding?
|
451
|
+
concat(content_tag("fb:wide", content, {}))
|
452
|
+
else
|
453
|
+
concat(content_tag("fb:wide", content, {}), proc.binding)
|
454
|
+
end
|
410
455
|
end
|
411
456
|
|
412
457
|
# Content for the narrow profile box goes in this tag
|
413
458
|
def fb_narrow(&proc)
|
414
459
|
content = capture(&proc)
|
415
|
-
|
460
|
+
if ignore_binding?
|
461
|
+
concat(content_tag("fb:narrow", content, {}))
|
462
|
+
else
|
463
|
+
concat(content_tag("fb:narrow", content, {}), proc.binding)
|
464
|
+
end
|
416
465
|
end
|
417
466
|
|
418
467
|
# Renders an action using the <fb:action> tag
|
@@ -428,27 +477,27 @@ module Facebooker
|
|
428
477
|
|
429
478
|
# Render a <fb:create-button> tag
|
430
479
|
# For use inside <fb:dashboard>
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
480
|
+
def fb_create_button(name, url)
|
481
|
+
"<fb:create-button href=\"#{url_for(url)}\">#{name}</fb:create-button>"
|
482
|
+
end
|
483
|
+
|
484
|
+
# Create a comment area
|
485
|
+
# All the data for this content area is stored on the facebook servers.
|
486
|
+
# <em>See:</em> http://wiki.developers.facebook.com/index.php/Fb:comments for full details
|
487
|
+
def fb_comments(xid,canpost=true,candelete=false,numposts=5,options={})
|
488
|
+
options = options.dup
|
440
489
|
title = (title = options.delete(:title)) ? fb_title(title) : nil
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
490
|
+
content_tag "fb:comments",title,stringify_vals(options.merge(:xid=>xid,:canpost=>canpost.to_s,:candelete=>candelete.to_s,:numposts=>numposts))
|
491
|
+
end
|
492
|
+
|
493
|
+
# Adds a title to the title bar
|
494
|
+
#
|
495
|
+
# Facebook | App Name | This is the canvas page window title
|
496
|
+
#
|
448
497
|
# +title+: This is the canvas page window
|
449
|
-
|
450
|
-
|
451
|
-
|
498
|
+
def fb_title(title)
|
499
|
+
"<fb:title>#{title}</fb:title>"
|
500
|
+
end
|
452
501
|
|
453
502
|
# Create a Google Analytics tag
|
454
503
|
#
|
@@ -463,16 +512,20 @@ module Facebooker
|
|
463
512
|
# Use fb_if_user_has_added_app to determine wether the user has added the app.
|
464
513
|
# Example:
|
465
514
|
# <% fb_if_is_app_user(@facebook_user) do %>
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
#
|
515
|
+
# Thanks for accepting our terms of service!
|
516
|
+
# <% fb_else do %>
|
517
|
+
# Hey you haven't agreed to our terms. <%= link_to("Please accept our terms of service.", :action => "terms_of_service") %>
|
518
|
+
# <% end %>
|
470
519
|
#<% end %>
|
471
520
|
def fb_if_is_app_user(user=nil,options={},&proc)
|
472
521
|
content = capture(&proc)
|
473
522
|
options = options.dup
|
474
523
|
options.merge!(:uid=>cast_to_facebook_id(user)) if user
|
475
|
-
|
524
|
+
if ignore_binding?
|
525
|
+
concat(content_tag("fb:if-is-app-user",content,stringify_vals(options)))
|
526
|
+
else
|
527
|
+
concat(content_tag("fb:if-is-app-user",content,stringify_vals(options)),proc.binding)
|
528
|
+
end
|
476
529
|
end
|
477
530
|
|
478
531
|
# Render if-user-has-added-app tag
|
@@ -480,15 +533,19 @@ module Facebooker
|
|
480
533
|
#
|
481
534
|
# Example:
|
482
535
|
# <% fb_if_user_has_added_app(@facebook_user) do %>
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
536
|
+
# Hey you are an app user!
|
537
|
+
# <% fb_else do %>
|
538
|
+
# Hey you aren't an app user. <%= link_to("Add App and see the other side.", :action => "added_app") %>
|
539
|
+
# <% end %>
|
487
540
|
#<% end %>
|
488
541
|
def fb_if_user_has_added_app(user,options={},&proc)
|
489
542
|
content = capture(&proc)
|
490
543
|
options = options.dup
|
491
|
-
|
544
|
+
if ignore_binding?
|
545
|
+
concat(content_tag("fb:if-user-has-added-app", content, stringify_vals(options.merge(:uid=>cast_to_facebook_id(user)))))
|
546
|
+
else
|
547
|
+
concat(content_tag("fb:if-user-has-added-app", content, stringify_vals(options.merge(:uid=>cast_to_facebook_id(user)))),proc.binding)
|
548
|
+
end
|
492
549
|
end
|
493
550
|
|
494
551
|
# Render fb:if-is-user tag
|
@@ -496,24 +553,32 @@ module Facebooker
|
|
496
553
|
# user can be a single user or an Array of users
|
497
554
|
# Example:
|
498
555
|
# <% fb_if_is_user(@check_user) do %>
|
499
|
-
#
|
500
|
-
#
|
501
|
-
#
|
502
|
-
#
|
503
|
-
#
|
556
|
+
# <%= fb_name(@facebook_user) %> are one of the users. <%= link_to("Check the other side", :action => "friend") %>
|
557
|
+
# <% fb_else do %>
|
558
|
+
# <%= fb_name(@facebook_user) %> are not one of the users <%= fb_name(@check_user) %>
|
559
|
+
# <%= link_to("Check the other side", :action => "you") %>
|
560
|
+
# <% end %>
|
504
561
|
# <% end %>
|
505
562
|
def fb_if_is_user(user,&proc)
|
506
563
|
content = capture(&proc)
|
507
564
|
user = [user] unless user.is_a? Array
|
508
565
|
user_list=user.map{|u| cast_to_facebook_id(u)}.join(",")
|
509
|
-
|
566
|
+
if ignore_binding?
|
567
|
+
concat(content_tag("fb:if-is-user",content,{:uid=>user_list}))
|
568
|
+
else
|
569
|
+
concat(content_tag("fb:if-is-user",content,{:uid=>user_list}),proc.binding)
|
570
|
+
end
|
510
571
|
end
|
511
572
|
|
512
573
|
# Render fb:else tag
|
513
574
|
# Must be used within if block such as fb_if_is_user or fb_if_is_app_user . See example in fb_if_is_app_user
|
514
575
|
def fb_else(&proc)
|
515
|
-
content = capture(&proc)
|
516
|
-
|
576
|
+
content = capture(&proc)
|
577
|
+
if ignore_binding?
|
578
|
+
concat(content_tag("fb:else",content))
|
579
|
+
else
|
580
|
+
concat(content_tag("fb:else",content),proc.binding)
|
581
|
+
end
|
517
582
|
end
|
518
583
|
|
519
584
|
#
|
@@ -559,6 +624,7 @@ module Facebooker
|
|
559
624
|
# * offline_access
|
560
625
|
# * status_update
|
561
626
|
# * photo_upload
|
627
|
+
# * video_upload
|
562
628
|
# * create_listing
|
563
629
|
# * create_event
|
564
630
|
# * rsvp_event
|
@@ -610,6 +676,17 @@ module Facebooker
|
|
610
676
|
concat(content_tag("fb:container",inner,options),&proc.binding)
|
611
677
|
end
|
612
678
|
|
679
|
+
# Renders an fb:time element
|
680
|
+
#
|
681
|
+
# Example:
|
682
|
+
# <%= fb_time(Time.now, :tz => 'America/New York', :preposition => true) %>
|
683
|
+
#
|
684
|
+
# See http://wiki.developers.facebook.com/index.php/Fb:time for
|
685
|
+
# more details
|
686
|
+
def fb_time(time, options={})
|
687
|
+
tag "fb:time",stringify_vals({:t => time.to_i}.merge(options))
|
688
|
+
end
|
689
|
+
|
613
690
|
protected
|
614
691
|
|
615
692
|
def cast_to_facebook_id(object)
|
@@ -618,13 +695,13 @@ module Facebooker
|
|
618
695
|
|
619
696
|
def validate_fb_profile_pic_size(options)
|
620
697
|
if options.has_key?(:size) && !VALID_FB_PROFILE_PIC_SIZES.include?(options[:size].to_sym)
|
621
|
-
raise(ArgumentError, "
|
698
|
+
raise(ArgumentError, "Unknown value for size: #{options[:size]}")
|
622
699
|
end
|
623
700
|
end
|
624
701
|
|
625
702
|
def validate_fb_photo_size(options)
|
626
703
|
if options.has_key?(:size) && !VALID_FB_PHOTO_SIZES.include?(options[:size].to_sym)
|
627
|
-
raise(ArgumentError, "
|
704
|
+
raise(ArgumentError, "Unknown value for size: #{options[:size]}")
|
628
705
|
end
|
629
706
|
end
|
630
707
|
|
@@ -652,6 +729,10 @@ module Facebooker
|
|
652
729
|
tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token)
|
653
730
|
end
|
654
731
|
end
|
732
|
+
|
733
|
+
def ignore_binding?
|
734
|
+
ActionPack::VERSION::MAJOR >= 2 && ActionPack::VERSION::MINOR >= 2
|
735
|
+
end
|
655
736
|
end
|
656
737
|
end
|
657
738
|
end
|