2010-11-19 22:45:18 +01:00
|
|
|
<% if @saved -%>
|
|
|
|
|
|
|
|
|
|
page_notify('notice', 'Note <%=@note.id %> saved', 5);
|
|
|
|
|
replace_note_form_with_updated_note();
|
|
|
|
|
|
|
|
|
|
<% else -%>
|
2010-11-24 22:01:23 +01:00
|
|
|
TracksForm.show_errors(html_for_error_messages());
|
2010-11-19 22:45:18 +01:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
|
|
function replace_note_form_with_updated_note() {
|
|
|
|
|
$('#<%= dom_id(@note, 'edit')%>').fadeOut(250, function() {
|
|
|
|
|
$('#<%= dom_id(@note, 'edit')%>').html(html_for_updated_note_form());
|
|
|
|
|
$('div.project_notes#<%= dom_id(@note)%>').html(html_for_updated_note_details());
|
|
|
|
|
$('#<%= dom_id(@note)%>').fadeIn(500);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function html_for_error_messages() {
|
|
|
|
|
return "<%= escape_javascript(error_messages_for('note')) %>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function html_for_updated_note_form(){
|
|
|
|
|
return "<%= escape_javascript(render(:partial => 'note_edit_form', :object => @note)) %>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function html_for_updated_note_details(){
|
|
|
|
|
return "<%= escape_javascript(render(:partial => 'note_details', :object => @note)) %>";
|
|
|
|
|
}
|