vendor/plugins/facebooker/lib/facebooker/rails/facebook_url_helper.rb
# Alters one and only one line of the Rails button_to.  See below.
Alters one and only one line of the Rails button_to.  See below.
Alters one and only one line of the Rails button_to . See below .
def button_to_with_facebooker(name, options={}, html_options = {})
        if !respond_to?(:request_comes_from_facebook?) || !request_comes_from_facebook?
           button_to_without_facebooker(name,options,html_options)
        else
          html_options = html_options.stringify_keys
          convert_boolean_attributes!(html_options, %w( disabled ))
          method_tag = ''
          if (method = html_options.delete('method')) && %w{put delete}.include?(method.to_s)
            method_tag = tag('input', :type => 'hidden', :name => '_method', :value => method.to_s)
          end
          form_method = method.to_s == 'get' ? 'get' : 'post'
          request_token_tag = ''
          if form_method == 'post' && protect_against_forgery?
            request_token_tag = tag(:input, :type => "hidden", :name => request_forgery_protection_token.to_s, :value => form_authenticity_token)
          end
          if confirm = html_options.delete("confirm")
            html_options["onclick"] = "#{confirm_javascript_function(confirm, 'a.getForm().submit();')}return false;"
          end
          url = options.is_a?(String) ? options : self.url_for(options)
          name ||= url
          html_options.merge!("type" => "submit", "value" => name)
          "<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" +
            method_tag + tag("input", html_options) + request_token_tag + "</div></form>"
        end
      end
def button_to_with_facebooker ( name , options = { } , html_options = { } ) if ! respond_to? ( :request_comes_from_facebook? ) || ! request_comes_from_facebook? button_to_without_facebooker ( name , options , html_options ) else html_options = html_options . stringify_keys convert_boolean_attributes! ( html_options , %w( disabled ) ) method_tag = '' if ( method = html_options . delete ( 'method' ) ) && %w{ put delete } . include? ( method . to_s ) method_tag = tag ( 'input' , :type => 'hidden' , :name => '_method' , :value => method . to_s ) end form_method = method . to_s == 'get' ? 'get' : 'post' request_token_tag = '' if form_method == 'post' && protect_against_forgery? request_token_tag = tag ( :input , :type => "hidden" , :name => request_forgery_protection_token . to_s , :value => form_authenticity_token ) end if confirm = html_options . delete ( "confirm" ) html_options [ "onclick" ] = "#{confirm_javascript_function(confirm, 'a.getForm().submit();')}return false;" end url = options . is_a? ( String ) ? options : self . url_for ( options ) name ||= url html_options . merge! ( "type" => "submit" , "value" => name ) "<form method=\"#{form_method}\" action=\"#{escape_once url}\" class=\"button-to\"><div>" + method_tag + tag ( "input" , html_options ) + request_token_tag + "</div></form>" end end
Alters one and only one line of the Rails button_to.
Alters one and only one line of the Rails button_to .
# this line is the only change => html_options["onclick"] = "return #{confirm_javascript_function(confirm)}"
name
<not_specific>
options
<not_specific>
html_options
<not_specific>