mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-18 21:28:08 +01:00
small refactorings of generated javascripts
This commit is contained in:
parent
8a3cb66e49
commit
6191cce4c7
33 changed files with 125 additions and 124 deletions
|
|
@ -17,9 +17,9 @@ function clear_form() {
|
|||
}
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@note)) %>";
|
||||
return "<%= js_error_messages_for(@note) %>";
|
||||
}
|
||||
|
||||
function html_for_note_summary() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => 'notes_summary', :object => @note)) : "" %>";
|
||||
return "<%= @saved ? js_render('notes_summary', {}, @note) : "" %>";
|
||||
}
|
||||
|
|
@ -1,10 +1,7 @@
|
|||
remove_deleted_note();
|
||||
remove_deleted_note(<%=@note.id%>);
|
||||
TracksPages.set_page_badge(<%=@down_count%>);
|
||||
TracksPages.page_notify('notice', "<%= t('notes.deleted_note', :id => @note.id)%>", 5);
|
||||
TracksPages.page_inform("<%= t('notes.deleted_note', :id => @note.id)%>");
|
||||
|
||||
function remove_deleted_note() {
|
||||
$('div#note-<%=@note.id%>-wrapper').slideUp(1000,
|
||||
function() {
|
||||
$('div#note-<%=@note.id%>-wrapper').remove();
|
||||
});
|
||||
function remove_deleted_note(id) {
|
||||
TracksPages.slide_up_and_remove('div#note-'+id+'-wrapper');
|
||||
}
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
<% if @saved -%>
|
||||
|
||||
TracksPages.hide_errors();
|
||||
TracksPages.page_notify('notice', 'Note <%=@note.id %> saved', 5);
|
||||
TracksPages.page_inform("<%= t('notes.save_status_message', id: @note.id) %>");
|
||||
replace_note_form_with_updated_note();
|
||||
|
||||
<% else -%>
|
||||
TracksPages.show_errors(html_for_error_messages());
|
||||
<% end %>
|
||||
|
|
@ -17,13 +15,13 @@ function replace_note_form_with_updated_note() {
|
|||
}
|
||||
|
||||
function html_for_error_messages() {
|
||||
return "<%= escape_javascript(get_list_of_error_messages_for(@note)) %>";
|
||||
return "<%= js_error_messages_for(@note) %>";
|
||||
}
|
||||
|
||||
function html_for_updated_note_form(){
|
||||
return "<%= escape_javascript(render(:partial => 'note_edit_form', :object => @note)) %>";
|
||||
return "<%= js_render('note_edit_form', {}, @note) %>";
|
||||
}
|
||||
|
||||
function html_for_updated_note_details(){
|
||||
return "<%= escape_javascript(render(:partial => 'note_details', :object => @note)) %>";
|
||||
return "<%= js_render('note_details', {}, @note) %>";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue