fix corner case that were failing the cucumber tests. On the calendar page at the end of the month, a todo may occur twice on the page. This was not taken into account for update an destroy

This commit is contained in:
Reinier Balt 2011-04-30 17:57:36 +02:00
parent 0ccf42d08c
commit 7f27a6e2bd
6 changed files with 36 additions and 15 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
*.tmproj
.dotest
/.emacs-project
/.redcar
config/database.yml
config/site.yml
config/deploy.rb

View file

@ -1279,6 +1279,16 @@ class TodosController < ApplicationController
true
end
def determine_non_uniq_todo
# for calendar view. TODO: unused
all_list_uniq_ids = (@due_today.map(&:id) + @due_this_week.map(&:id) +
@due_next_week.map(&:id) + @due_this_month.map(&:id) + @due_after_this_month.map(&:id)).uniq
all_list_count = @due_today.count + @due_this_week.count +
@due_next_week.count + @due_this_month.count + @due_after_this_month.count
return !( all_list_uniq_ids.length == all_list_count )
end
class FindConditionBuilder
def initialize

View file

@ -32,19 +32,24 @@ function show_empty_messages() {
function remove_todo_from_page() {
<% if (@remaining_in_context == 0) && update_needs_to_hide_context
# remove context with deleted todo
# remove context with deleted todo
-%>
$('#c<%=@todo.context_id%>').fadeOut(400, function() {
$('#<%=dom_id(@todo)%>').remove();
});
<%= show_empty_message_in_source_container -%>
$('#c<%=@todo.context_id%>').fadeOut(400, function() {
$('#<%=dom_id(@todo)%>').remove();
});
<%= show_empty_message_in_source_container -%>
<% else
# remove only the todo
# remove only the todo
-%>
<%= show_empty_message_in_source_container %>
$('#<%=dom_id(@todo)%>').slideUp(400, function() {
$('#<%=dom_id(@todo)%>').remove();
});
<%= show_empty_message_in_source_container %>
$('#<%=dom_id(@todo)%>').slideUp(400, function() {
$('#<%=dom_id(@todo)%>').remove();
<% if source_view_is :calendar
# in calendar view it is possible to have a todo twice on the page
-%>
$('#<%=dom_id(@todo)%>').remove();
<% end %>
});
<% end -%>
}

View file

@ -27,6 +27,11 @@
function remove_todo(next_steps) {
$('#<%= dom_id(@todo) %>').fadeOut(400, function() {
$('#<%= dom_id(@todo) %>').remove();
<% if source_view_is :calendar
# in calendar view it is possible to have a todo twice on the page
-%>
$('#<%= dom_id(@todo) %>').remove();
<% end %>
<%= show_empty_message_in_source_container -%>
next_steps.go();
});

View file

@ -327,7 +327,7 @@ nl:
show_tomorrow: Toon morgen
calendar:
get_in_ical_format: Ontvang deze agenda in iCal-formaat
due_next_week: Deadline deze week
due_next_week: Deadline volgende week
due_this_week: Deadline in rest van deze week
no_actions_due_next_week: Geen acties met deadline in volgende week
due_today: Deadline vandaag