mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 15:50:13 +01:00
33 lines
981 B
Text
33 lines
981 B
Text
|
|
<% if @saved -%>
|
||
|
|
|
||
|
|
page_notify('notice', 'Note <%=@note.id %> saved', 5);
|
||
|
|
replace_note_form_with_updated_note();
|
||
|
|
|
||
|
|
<% else -%>
|
||
|
|
show_errors();
|
||
|
|
<% end %>
|
||
|
|
|
||
|
|
function show_errors() {
|
||
|
|
$('div#edit_error_status').html(html_for_error_messages());
|
||
|
|
$('div#edit_error_status').show();
|
||
|
|
}
|
||
|
|
|
||
|
|
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)) %>";
|
||
|
|
}
|