<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/test_helper.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,2 +1,2 @@
 ActionController::Base.send :include, InPlaceEditing
-ActionController::Base.helper InPlaceMacrosHelper
+ActionController::Base.helper InPlaceMacrosHelper
\ No newline at end of file</diff>
      <filename>init.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,6 +40,12 @@ module InPlaceMacrosHelper
     function &lt;&lt; &quot;'#{url_for(options[:url])}'&quot;
 
     js_options = {}
+
+    if protect_against_forgery?
+      options[:with] ||= &quot;Form.serialize(form)&quot;
+      options[:with] += &quot; + '&amp;authenticity_token=' + encodeURIComponent('#{form_authenticity_token}')&quot;
+    end
+
     js_options['cancelText'] = %('#{options[:cancel_text]}') if options[:cancel_text]
     js_options['okText'] = %('#{options[:save_text]}') if options[:save_text]
     js_options['loadingText'] = %('#{options[:loading_text]}') if options[:loading_text]
@@ -50,9 +56,10 @@ module InPlaceMacrosHelper
     js_options['externalControl'] = &quot;'#{options[:external_control]}'&quot; if options[:external_control]
     js_options['loadTextURL'] = &quot;'#{url_for(options[:load_text_url])}'&quot; if options[:load_text_url]        
     js_options['ajaxOptions'] = options[:options] if options[:options]
-    js_options['evalScripts'] = options[:script] if options[:script]
+    js_options['htmlResponse'] = !options[:script] if options[:script]
     js_options['callback']   = &quot;function(form) { return #{options[:with]} }&quot; if options[:with]
     js_options['clickToEditText'] = %('#{options[:click_to_edit_text]}') if options[:click_to_edit_text]
+    js_options['textBetweenControls'] = %('#{options[:text_between_controls]}') if options[:text_between_controls]
     function &lt;&lt; (', ' + options_for_javascript(js_options)) unless js_options.empty?
     
     function &lt;&lt; ')'</diff>
      <filename>lib/in_place_macros_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,4 @@
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../../test/test_helper'))
-require 'test/unit'
+require File.expand_path(File.dirname(__FILE__) + &quot;/test_helper&quot;)
 
 class InPlaceEditingTest &lt; Test::Unit::TestCase
   include InPlaceEditing
@@ -20,8 +19,13 @@ class InPlaceEditingTest &lt; Test::Unit::TestCase
       end
     end
     @controller = @controller.new
+    @protect_against_forgery = false
   end
-  
+
+  def protect_against_forgery?
+    @protect_against_forgery
+  end
+
   def test_in_place_editor_external_control
       assert_dom_equal %(&lt;script type=\&quot;text/javascript\&quot;&gt;\n//&lt;![CDATA[\nnew Ajax.InPlaceEditor('some_input', 'http://www.example.com/inplace_edit', {externalControl:'blah'})\n//]]&gt;\n&lt;/script&gt;),
         in_place_editor('some_input', {:url =&gt; {:action =&gt; 'inplace_edit'}, :external_control =&gt; 'blah'})
@@ -59,11 +63,27 @@ class InPlaceEditingTest &lt; Test::Unit::TestCase
       :load_text_url =&gt; { :action =&gt; &quot;action_to_get_value&quot; })
   end
   
-  def test_in_place_editor_eval_scripts
-    assert_match &quot;Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {evalScripts:true})&quot;,
+  def test_in_place_editor_html_response
+    assert_match &quot;Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {htmlResponse:false})&quot;,
     in_place_editor( 'id-goes-here', 
       :url =&gt; { :action =&gt; &quot;action_to_set_value&quot; }, 
       :script =&gt; true )
   end
   
+  def form_authenticity_token
+    &quot;authenticity token&quot;
+  end
+
+  def test_in_place_editor_with_forgery_protection
+    @protect_against_forgery = true
+    assert_match &quot;Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {callback:function(form) { return Form.serialize(form) + '&amp;authenticity_token=' + encodeURIComponent('authenticity token') }})&quot;,
+    in_place_editor( 'id-goes-here', :url =&gt; { :action =&gt; &quot;action_to_set_value&quot; })
+  end
+
+  def test_in_place_editor_text_between_controls
+    assert_match &quot;Ajax.InPlaceEditor('id-goes-here', 'http://www.example.com/action_to_set_value', {textBetweenControls:'or'})&quot;,
+    in_place_editor( 'id-goes-here',
+      :url =&gt; { :action =&gt; &quot;action_to_set_value&quot; },
+      :text_between_controls =&gt; &quot;or&quot; )
+  end
 end
\ No newline at end of file</diff>
      <filename>test/in_place_editing_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>81bee9dd39d36b0bc268465a6d37c76e6423c891</id>
    </parent>
  </parents>
  <author>
    <name>Jose Fernandez</name>
    <email>jose@umn.edu</email>
  </author>
  <url>http://github.com/rails/in_place_editing/commit/afb68bba782f8ae0ea56494f200f1fe9c811e164</url>
  <id>afb68bba782f8ae0ea56494f200f1fe9c811e164</id>
  <committed-date>2008-07-07T14:15:40-07:00</committed-date>
  <authored-date>2008-07-02T14:09:03-07:00</authored-date>
  <message>Make the plugin work with RequestForgeryProtection and update deprecated prototype code.

Signed-off-by: Pratik Naik &lt;pratiknaik@gmail.com&gt;</message>
  <tree>a3cf8e305391cfb743ce7dc2386e446464530aa9</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
