module FGraph module Rails module FGraphTagHelper def fgraph_javascript_include_tag %{} end # Inititalize XFBML Javascript include and initialization script. # # ==== Options # * app_id - overrride Fgraph.config['app_id'] value. # * async - asynchronous javascript include & initialization. # for other Facebook JS initialization codes please wrap under: # * status - default: false, will check login status, and auto-login user if they are connected # * cookie - default: true, auto set cookies # * xfbml - default: true, auto parse xfbml tags # # If async is set to true, the callback function is window.afterFbAsyncInit, e.g. # window.afterFbAsyncInit = function() { # .... # } # def fgraph_javascript_init_tag(options={}) options = { :app_id => FGraph.config['app_id'], :status => true, :cookie => true, :xfbml => true }.merge(options || {}) fb_init = "FB.init({appId: '#{options[:app_id]}', status: #{options[:status]}, cookie: #{options[:cookie]}, xfbml: #{options[:xfbml]}});" if options[:async] %{
} else tag = fgraph_javascript_include_tag tag << %{ } end end def fgraph_image_tag(id, type=nil, options={}) default_options = fgraph_image_options(type) default_options[:alt] = id['name'] if id.is_a?(Hash) image_tag(fgraph_picture_url(id, type), default_options.merge(options || {})) end def fgraph_image_options(type) case type when 'square' {:width => 50, :height => 50} when 'small' {:width => 50} when 'normal' {:width => 100} when 'large' {:width => 200} else {:width => 50, :height => 50} end end end end end