<%% if @<%= instance_name %>.errors.blank? %> // Fill the right box with first <%= instance_name %> details $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'show')) %>"); // Add the newly created item to the list $("#div_<%= instance_name %>_collections").prepend("
_<%%= @<%= instance_name %>.id %>\"><%%= escape_javascript(render(:partial => 'item', :locals => { :<%= instance_name %> => @<%= instance_name %> })) %>
") $("#div_<%= instance_name %>_empty").hide(); <%% else %> // Reload the form partial to display errors $('#div_<%= instance_name %>_details').html("<%%= escape_javascript(render(:partial=>'new')) %>"); <%% end %>