Module: Facebooker2::Rails::Helpers::User
- Included in:
- Facebooker2::Rails::Helpers
- Defined in:
- lib/facebooker2/rails/helpers/user.rb
Constant Summary collapse
- FB_NAME_OPTION_KEYS_TO_TRANSFORM =
{:first_name_only => :firstnameonly, :last_name_only => :lastnameonly, :show_network => :shownetwork, :use_you => :useyou, :if_cant_see => :ifcantsee, :subject_id => :subjectid}
- FB_NAME_VALID_OPTION_KEYS =
[:firstnameonly, :linked, :lastnameonly, :possessive, :reflexive, :shownetwork, :useyou, :ifcantsee, :capitalize, :subjectid]
- FB_PROFILE_PIC_OPTION_KEYS_TO_TRANSFORM =
{:facebook_logo => 'facebook-logo'}
- FB_PROFILE_PIC_VALID_OPTION_KEYS =
[:size, :linked, 'facebook-logo', :width, :height]
- VALID_FB_PROFILE_PIC_SIZES =
[:thumb, :small, :normal, :square]
Instance Method Summary collapse
-
#fb_name(user, options = {}) ⇒ Object
Render an fb:name tag for the given user This renders the name of the user specified.
- #fb_profile_pic(user, options = {}) ⇒ Object
- #validate_fb_profile_pic_size(options) ⇒ Object
Instance Method Details
#fb_name(user, options = {}) ⇒ Object
Render an fb:name tag for the given user This renders the name of the user specified. You can use this tag as both subject and object of a sentence. See wiki.developers.facebook.com/index.php/Fb:name for full description.
Use this tag on FBML pages instead of retrieving the user’s info and rendering the name explicitly.
10 11 12 13 14 15 |
# File 'lib/facebooker2/rails/helpers/user.rb', line 10 def fb_name(user, ={}) = fb_transform_keys(,FB_NAME_OPTION_KEYS_TO_TRANSFORM) fb_assert_valid_keys(, FB_NAME_VALID_OPTION_KEYS) .merge!(:uid => Facebooker2.cast_to_facebook_id(user)) content_tag("fb:name",nil, fb_stringify_vals()) end |
#fb_profile_pic(user, options = {}) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/facebooker2/rails/helpers/user.rb', line 27 def fb_profile_pic(user, ={}) = .dup validate_fb_profile_pic_size() = fb_transform_keys(,FB_PROFILE_PIC_OPTION_KEYS_TO_TRANSFORM) fb_assert_valid_keys(,FB_PROFILE_PIC_VALID_OPTION_KEYS) .merge!(:uid => Facebooker2.cast_to_facebook_id(user)) content_tag("fb:profile-pic", nil,fb_stringify_vals()) end |
#validate_fb_profile_pic_size(options) ⇒ Object
39 40 41 42 43 |
# File 'lib/facebooker2/rails/helpers/user.rb', line 39 def validate_fb_profile_pic_size() if .has_key?(:size) && !VALID_FB_PROFILE_PIC_SIZES.include?([:size].to_sym) raise(ArgumentError, "Unknown value for size: #{[:size]}") end end |