Module: Facebooker::Merb::Helpers
- Defined in:
- lib/merb_facebooker/helpers.rb
Constant Summary collapse
- VALID_FB_SHARED_PHOTO_SIZES =
const
[:thumb, :small, :normal, :square]
- VALID_FB_PHOTO_SIZES =
VALID_FB_SHARED_PHOTO_SIZES
- VALID_FB_PROFILE_PIC_SIZES =
VALID_FB_SHARED_PHOTO_SIZES
- VALID_FB_SHARED_ALIGN_VALUES =
[:left, :right]
- VALID_FB_PHOTO_ALIGN_VALUES =
VALID_FB_SHARED_ALIGN_VALUES
- VALID_FB_TAB_ITEM_ALIGN_VALUES =
VALID_FB_SHARED_ALIGN_VALUES
- FB_PHOTO_VALID_OPTION_KEYS =
[:uid, :size, :align]
Instance Method Summary collapse
- #cast_to_photo_id(object) ⇒ Object
-
#fb_photo(photo, options = {}) ⇒ Object
- Provides a FBML fb_photo tag with the a facebook photo ==== Parameters photo<Facebooker::Photo>
- The photo object Or Objec that respond to photo_id options<Hash>
-
specify the pic size and .
-
#fb_profile_pic(user, options = {}) ⇒ Object
- Provides a FBML fb_profile_pic tag with the provided uid ==== Parameters user<OrmObject>
- The user object options<Hash>
-
specify the users picture size.
-
#fb_request_form(type, message_param, url, &block) ⇒ Object
Create an fb:request-form without a selector.
Instance Method Details
#cast_to_photo_id(object) ⇒ Object
82 83 84 |
# File 'lib/merb_facebooker/helpers.rb', line 82 def cast_to_photo_id(object) object.respond_to?(:photo_id) ? object.photo_id : object end |
#fb_photo(photo, options = {}) ⇒ Object
Provides a FBML fb_photo tag with the a facebook photo
Parameters
- photo<Facebooker::Photo>
-
The photo object Or Objec that respond to photo_id
- options<Hash>
-
specify the pic size and
Options (options)
<em> See: </em> http://wiki.developers.facebook.com/index.php/Fb:photo for complete list of options
Returns
- String
-
The fbml photo tag defaulting with thumb picture
Example
<%= fb_profile_pic(@user) %>
74 75 76 77 78 79 80 |
# File 'lib/merb_facebooker/helpers.rb', line 74 def fb_photo(photo, = {}) # options.assert_valid_keys(FB_PHOTO_VALID_OPTION_KEYS) # TODO asserts .merge!(:pid => cast_to_photo_id(photo)) validate_fb_photo_size() validate_fb_photo_align_value() self_closing_tag("fb:photo", ) end |
#fb_profile_pic(user, options = {}) ⇒ Object
Provides a FBML fb_profile_pic tag with the provided uid
Parameters
- user<OrmObject>
-
The user object
- options<Hash>
-
specify the users picture size
Options (options)
:size<Symbol>:: The size of the profile picture :small, :normal and :square
Returns
- String
-
The fbml tag defaulting with thumb picture
Example
<%= fb_profile_pic(@user) %>
53 54 55 56 57 |
# File 'lib/merb_facebooker/helpers.rb', line 53 def fb_profile_pic(user, = {}) validate_fb_profile_pic_size() .merge!(:uid => cast_to_facebook_id(user)) self_closing_tag("fb:profile-pic", ) end |
#fb_request_form(type, message_param, url, &block) ⇒ Object
Create an fb:request-form without a selector
The block passed to this tag is used as the content of the form
The message param is the name sent to content_for that specifies the body of the message
For example,
<% content_for("invite_message") do %>
This gets sent in the invite. <%= fb_req_choice("with a button!",new_poke_path) %>
<% end %>
<% fb_request_form("Poke","invite_message",create_poke_path) do %>
Send a poke to: <%= fb_friend_selector %> <br />
<%= fb_request_form_submit %>
<% end %>
31 32 33 34 35 36 37 |
# File 'lib/merb_facebooker/helpers.rb', line 31 def fb_request_form(type ,,url,&block) content = capture(&block) = @_caught_content[] concat(tag("fb:request-form", content, {:action=>url,:method=>"post",:invite=>true,:type=>type,:content=>}), block.binding) end |