2010-11-24 22:01:23 +01:00
|
|
|
<% if @saved -%>
|
2010-11-25 23:29:32 +01:00
|
|
|
TracksPages.hide_errors();
|
2010-11-24 22:01:23 +01:00
|
|
|
add_note();
|
|
|
|
|
clear_form();
|
|
|
|
|
<% else -%>
|
2010-11-25 23:29:32 +01:00
|
|
|
TracksPages.show_errors(html_for_error_messages());
|
2010-11-24 22:01:23 +01:00
|
|
|
<% end -%>
|
|
|
|
|
|
|
|
|
|
function add_note() {
|
|
|
|
|
$('div#notes').append(html_for_note_summary());
|
|
|
|
|
$('#empty-n').hide();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function clear_form() {
|
|
|
|
|
$('#new-note').hide();
|
|
|
|
|
$('#edit-note-form').clearForm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function html_for_error_messages() {
|
2014-08-10 20:43:27 +02:00
|
|
|
return "<%= js_error_messages_for(@note) %>";
|
2010-11-24 22:01:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function html_for_note_summary() {
|
2014-08-10 20:43:27 +02:00
|
|
|
return "<%= @saved ? js_render('notes_summary', {}, @note) : "" %>";
|
2010-11-24 22:01:23 +01:00
|
|
|
}
|