refactor application.rb further and migrate recurring todos

next: get tests for recurring todos
This commit is contained in:
Reinier Balt 2010-12-03 17:52:24 +01:00
parent 484356fe07
commit cafa774b4c
33 changed files with 688 additions and 571 deletions

View file

@ -1,7 +1,7 @@
<% if @saved -%>
hide_empty_message();
TracksPages.hide_errors();
set_page_badge(<%= @down_count %>);
TracksPages.set_page_badge(<%= @down_count %>);
add_context("<%=@context.hidden? ? 'hidden' : 'active'%>");
clear_form();
<% else -%>

View file

@ -3,13 +3,12 @@ remove_deleted_context();
ContextListPage.update_all_states_count(<%=@active_contexts_count%>, <%=@hidden_contexts_count%>)
ContextListPage.show_or_hide_all_state_containers(<%= @show_active_contexts %>, <%= @show_hidden_contexts %>);
set_page_badge(<%=@down_count%>);
page_notify('notice', "<%= t('contexts.context_deleted', :name=>@context.name)%>", 5);
TracksPages.set_page_badge(<%=@down_count%>);
TracksPages.page_notify('notice', "<%= t('contexts.context_deleted', :name=>@context.name)%>", 5);
/* TODO: refactor and move function to application.js */
function remove_deleted_context() {
$('div#<%=dom_id(@context, "container")%>').slideUp(1000,
function() {
$('div#<%=dom_id(@context, "container")%>').slideUp(1000, function() {
$('div#<%=dom_id(@context, "container")%>').remove();
});
});
}

View file

@ -1,6 +1,6 @@
<% if @saved -%>
page_notify('notice', '<%= t('contexts.save_status_message') %>', 5);
TracksPages.page_notify('notice', '<%= t('contexts.save_status_message') %>', 5);
<% if @state_changed -%>
remove_and_re_add_context();
@ -9,7 +9,7 @@
<% end -%>
<% else -%>
show_errors();
TracksPages.show_edit_errors(html_for_error_messages());
<% end -%>
function remove_and_re_add_context() {
@ -33,11 +33,6 @@ function replace_context_form_with_updated_context() {
});
}
function show_errors() {
$('div#edit_error_status').html(html_for_error_messages());
$('div#edit_error_status').show();
}
function html_for_error_messages() {
return "<%= escape_javascript(error_messages_for('context')) %>";
}