This is my first post to the list, so I hope it gets through and I don’t
do anything wrong
Welcome aboard!
I have an rjs that’s doing:
page.replace_html ‘myid’, :partial => ‘my_partial’
And in my my_partial I have:
If it makes sense to do it in the RJS template, you can just do
page.alert(‘foo’). If that doesn’t make sense, posting more of the code
might help you get a better answer.
Not quite the same thing, but as a data point: I have one app that uses
a lot of Ajax editing. The link that shows initially is a
link_to_remote. The method it points to renders javascript via render
:template. The template it renders, in turn, calls replace_html with a
partial. The partial includes a form_remote_tag.
All of this works fine, no problems with the escaping or anything. It
seems like a vaguely comparable situation, so I thought I’d mention it.
Not quite the same thing, but as a data point: I have one app that
uses
a lot of Ajax editing. The link that shows initially is a
link_to_remote. The method it points to renders javascript via render
:template. The template it renders, in turn, calls replace_html with a
partial. The partial includes a form_remote_tag.
All of this works fine, no problems with the escaping or anything. It
seems like a vaguely comparable situation, so I thought I’d mention
it.
Aha. This isn’t exactly the same thing, but it got me thinking, and
after a good night’s sleep, here’s what the problem actually was:
In my rjs I was rendering a partial that had tags in it…
but this works if you just set up a test case. The problem actually
was with Sean Treadway’s responds_to_parent (http://
sean.treadway.info/articles/2006/05/29/iframe-remoting-made-easy) and
my iframe trickery.
As it turns out, his plugin seems to have the escaping problem.
Sorry this wasn’t actually related to the core like I had originally
thought, but thank you for prompting me to fix it
If anyone needs more details, feel free to mail me.
I have an rjs that’s doing:
page.replace_html ‘myid’, :partial => ‘my_partial’
And in my my_partial I have:
If it makes sense to do it in the RJS template, you can just do
page.alert(‘foo’). If that doesn’t make sense, posting more of the
code might help you get a better answer.
So, although it’s the same problem as my alert() above from the point
of view of “it’s escaping wrong”… I don’t think I can do the
in_place_editor in the rjs like page.in_place_editor().
I guess I could look to see how in_place_editor does it’s thing,
strip out the javascript part, and << it into page. Then include an
extra line in my partial that doesn’t try to do the in_place_editor
if it’s an rjs page_replace. But that seems unclean, and it’d also
seem like if replace_html isn’t broken by not being able to include a
in it... it should raise an error, or have a note in the
rdoc, or something, so people like me aren't just staring blankly at
it :)
Let me know what you think.
--hax