vendor/plugins/facebooker/lib/facebooker/rails/facebook_url_helper.rb
# Dynamically creates a form for link_to with method.  Calls confirm_javascript_function if and 
# only if (confirm && method) for link_to
Dynamically creates a form for link_to with method.  Calls confirm_javascript_function if and
only if (confirm && method) for link_to
Dynamically creates a form for link_to with method . Calls confirm_javascript_function if and only if ( confirm && method ) for link_to
def method_javascript_function_with_facebooker(method, url = '', href = nil, confirm = nil)
          if !respond_to?(:request_comes_from_facebook?) || !request_comes_from_facebook?
            method_javascript_function_without_facebooker(method,url,href)
 	  else
            action = (href && url.size > 0) ? "'#{url}'" : 'a.getHref()'
            submit_function =
              "var f = document.createElement('form'); f.setStyle('display','none'); " +
              "a.getParentNode().appendChild(f); f.setMethod('POST'); f.setAction(#{action});"
            unless method == :post
              submit_function << "var m = document.createElement('input'); m.setType('hidden'); "
              submit_function << "m.setName('_method'); m.setValue('#{method}'); f.appendChild(m);"
            end
            if protect_against_forgery?
              submit_function << "var s = document.createElement('input'); s.setType('hidden'); "
              submit_function << "s.setName('#{request_forgery_protection_token}'); s.setValue('#{escape_javascript form_authenticity_token}'); f.appendChild(s);"
            end
            submit_function << "f.submit();"
	    if(confirm)
	      confirm_javascript_function(confirm, submit_function)
  	    else
	      "var a=this;" + submit_function
 	    end
          end
	end
def method_javascript_function_with_facebooker ( method , url = '' , href = nil , confirm = nil ) if ! respond_to? ( :request_comes_from_facebook? ) || ! request_comes_from_facebook? method_javascript_function_without_facebooker ( method , url , href ) else action = ( href && url . size > 0 ) ? "'#{url}'" : 'a.getHref()' submit_function = "var f = document.createElement('form'); f.setStyle('display','none'); " + "a.getParentNode().appendChild(f); f.setMethod('POST'); f.setAction(#{action});" unless method == :post submit_function << "var m = document.createElement('input'); m.setType('hidden'); " submit_function << "m.setName('_method'); m.setValue('#{method}'); f.appendChild(m);" end if protect_against_forgery? submit_function << "var s = document.createElement('input'); s.setType('hidden'); " submit_function << "s.setName('#{request_forgery_protection_token}'); s.setValue('#{escape_javascript form_authenticity_token}'); f.appendChild(s);" end submit_function << "f.submit();" if ( confirm ) confirm_javascript_function ( confirm , submit_function ) else "var a=this;" + submit_function end end end
Dynamically creates a form for link_to with method.
Dynamically creates a form for link_to with method .
method
<not_specific>
url
<not_specific>
href
<not_specific>
confirm
<not_specific>