Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8879

Show
Ignore:
Timestamp:
02/16/08 00:07:52 (5 months ago)
Author:
nzkoz
Message:

Ensure that :confirm doesn't need extra quotes when using drop_receiving_element. Closes #8299 [thechrisoshow]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_view/helpers/scriptaculous_helper.rb

    r8294 r8879  
    193193        options[:hoverclass] = "'#{options[:hoverclass]}'" if options[:hoverclass] 
    194194         
     195        # Confirmation happens during the onDrop callback, so it can be removed from the options 
     196        options.delete(:confirm) if options[:confirm] 
     197 
    195198        %(Droppables.add(#{element_id.to_json}, #{options_for_javascript(options)});) 
    196199      end 
  • trunk/actionpack/test/template/scriptaculous_helper_test.rb

    r8564 r8879  
    8989    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add(\"droptarget1\", {accept:['tshirts','mugs'], onDrop:function(element){new Ajax.Updater('infobox', 'http://www.example.com/', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)})}})\n//]]>\n</script>), 
    9090      drop_receiving_element("droptarget1", :accept => ['tshirts','mugs'], :update => 'infobox') 
     91    assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nDroppables.add("droptarget1", {hoverclass:'dropready', onDrop:function(element){if (confirm('Are you sure?')) { new Ajax.Request('http://www.example.com/update_drop', {asynchronous:true, evalScripts:true, parameters:'id=' + encodeURIComponent(element.id)}); }}})\n//]]>\n</script>), 
     92    drop_receiving_element('droptarget1', :hoverclass=>'dropready', :url=>{:action=>'update_drop'}, :confirm => 'Are you sure?') 
     93 
    9194  end 
    92  
    9395  def protect_against_forgery? 
    9496    false