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: # # window.afterFbAsyncInit = function() { # .... # } # def fgraph_javascript_init_tag(options={}) options = { :app_id => FGraph.config['app_id'] }.merge(options || {}) 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