| |
Low Pro |
There's a few approaches you could take. The first one would be to Event.addBehavior({ -- aim: danwrong123
> had to go back to the server, rather than all be done client side as
> it was before... is there another way?
HTML/JavaScript. That's a great example of something that looks
perfectly acceptable at the Ruby end but is in fact pretty damn nasty.
clone one of the previous task chunks and appendChild to the form. A
nice way to do this is write a behaviour that clones a copy as soon as
the page is loaded (while the form values are still blank) then makes
clones from that as needed. The second is that you could basically do
what add_task_link does:
'#add_task_link:click': function() {
$('taskform').insert(<%= render(:partial => 'project/task', ...).to_json);
}
into a JS quoted string. Third option would be to use DOM Builder.
I'd go with cloning nodes though, it seems cleaner.
Dan Webb
http://www.danwebb.net
skype: danwrong