mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-22 23:24:07 +01:00
refactor sidebar and finish migration of notes
This commit is contained in:
parent
94b5aa2346
commit
ea1ca130f1
18 changed files with 138 additions and 97 deletions
25
app/views/notes/create.js.erb
Normal file
25
app/views/notes/create.js.erb
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<% if @saved -%>
|
||||
TracksForm.hide_errors();
|
||||
add_note();
|
||||
clear_form();
|
||||
<% else -%>
|
||||
TracksForm.show_errors(html_for_error_messages());
|
||||
<% 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() {
|
||||
return "<%= escape_javascript(error_messages_for('project')) %>";
|
||||
}
|
||||
|
||||
function html_for_note_summary() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => 'notes_summary', :object => @note)) : "" %>";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue