vendor/plugins/facebooker/lib/facebooker/rails/helpers.rb
# Create a facebook form using <fb:editor>
#
# It yields a form builder that will convert the standard rails form helpers 
# into the facebook specific version. 
#
# Example:
#  <% facebook_form_for(:poke,@poke,:url => create_poke_path) do |f| %>
#    <%= f.text_field :message, :label=>"message" %>
#    <%= f.buttons "Save Poke" %>
#  <% end %>
#
#  will generate
#
#  <fb:editor action="/pokes/create">
#    <fb:editor-text name="poke[message]" id="poke_message" value="" label="message" />
#    <fb:editor-buttonset>
#     <fb:editor-button label="Save Poke"
#    </fb:editor-buttonset>
#  </fb:editor>
Create a facebook form using 
It yields a form builder that will convert the standard rails form helpers
into the facebook specific version.



will generate


Create a facebook form using It yields a form builder that will convert the standard rails form helpers into the facebook specific version . will generate
def facebook_form_for( record_or_name_or_array,*args, &proc)
        raise ArgumentError, "Missing block" unless block_given?
        options = args.last.is_a?(Hash) ? args.pop : {}
        case record_or_name_or_array
        when String, Symbol
          object_name = record_or_name_or_array
        when Array
          object = record_or_name_or_array.last
          object_name = ActionController::RecordIdentifier.singular_class_name(object)
          apply_form_for_options!(record_or_name_or_array, options)
          args.unshift object
        else
          object = record_or_name_or_array
          object_name = ActionController::RecordIdentifier.singular_class_name(object)
          apply_form_for_options!([object], options)
          args.unshift object
        end
        method = (options[:html]||{})[:method]
        options[:builder] ||= Facebooker::Rails::FacebookFormBuilder
        editor_options={}
        action=options.delete(:url)
        editor_options[:action]= action unless action.blank?
        width=options.delete(:width)
        editor_options[:width]=width unless width.blank?
        width=options.delete(:labelwidth)
        editor_options[:labelwidth]=width unless width.blank?
        versioned_concat(tag("fb:editor",editor_options,true) , proc.binding)
        versioned_concat(tag(:input,{:type=>"hidden",:name=>:_method, :value=>method},false), proc.binding) unless method.blank?
        versioned_concat(token_tag, proc.binding)
        fields_for( object_name,*(args << options), &proc)
        versioned_concat("</fb:editor>",proc.binding)
      end
def facebook_form_for ( record_or_name_or_array , * args , & proc ) raise ArgumentError , "Missing block" unless block_given? options = args . last . is_a? ( Hash ) ? args . pop : { } case record_or_name_or_array when String , Symbol object_name = record_or_name_or_array when Array object = record_or_name_or_array . last object_name = ActionController :: RecordIdentifier . singular_class_name ( object ) apply_form_for_options! ( record_or_name_or_array , options ) args . unshift object else object = record_or_name_or_array object_name = ActionController :: RecordIdentifier . singular_class_name ( object ) apply_form_for_options! ( [ object ] , options ) args . unshift object end method = ( options [ :html ] || { } ) [ :method ] options [ :builder ] ||= Facebooker :: Rails :: FacebookFormBuilder editor_options = { } action = options . delete ( :url ) editor_options [ :action ] = action unless action . blank? width = options . delete ( :width ) editor_options [ :width ] = width unless width . blank? width = options . delete ( :labelwidth ) editor_options [ :labelwidth ] = width unless width . blank? versioned_concat ( tag ( "fb:editor" , editor_options , true ) , proc . binding ) versioned_concat ( tag ( :input , { :type => "hidden" , :name => :_method , :value => method } , false ) , proc . binding ) unless method . blank? versioned_concat ( token_tag , proc . binding ) fields_for ( object_name , * ( args << options ) , & proc ) versioned_concat ( "</fb:editor>" , proc . binding ) end
Create a facebook form using <fb:editor>
It yields a form builder that will convert the standard rails form helpers
into the facebook specific version.
Create a facebook form using <fb : editor > It yields a form builder that will convert the standard rails form helpers into the facebook specific version .
record_or_name_or_array
<not_specific>
args
<not_specific>
proc
<not_specific>