Created
February 22, 2010 02:04
-
-
Save recursive/310704 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def html_safe_ajax_partial(name, partial, div) | |
| link_to_remote name, :url => new_session_url(:partial => partial, :format => 'js'), :update => div, :method => :get, :html => { :href => new_session_url(:partial => partial) } | |
| end | |
| #html_safe_ajax_partial('Hello', 'hi', 'coolstuff') | |
| #The above properly generates http://domain/session/new?partial=hi in the coolstuff div with text 'Hello' | |
| #<a onclick="new Ajax.Updater('page_contents', 'http://localhost:3001/session/new.js?partial=hi', {asynchronous:true, evalScripts:true, method:'get', parameters:'authenticity_token=' + encodeURIComponent('U44dXFOJa2g4cpjYTL+SwSySN3lh0jo9dD8joocNEgo=')}); return false;" href="http://localhost:3001/session/new?partial=about">Hello</a> | |
| #I want one to generate: | |
| #<a onclick="new Ajax.Updater('page_contents', 'http://localhost:3001/session/new.js?partial=hi', {asynchronous:true, evalScripts:true, method:'get', parameters:'authenticity_token=' + encodeURIComponent('U44dXFOJa2g4cpjYTL+SwSySN3lh0jo9dD8joocNEgo=')}); return false;" href="http://localhost:3001/session/new?partial=about"><span><span>Hello</span></span></a> | |
| #Notice the spans -- I have to do this as the css guy did it this way :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment