diff --git a/.gitignore b/.gitignore index 0af7cb4e8..bd41271d6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.tmproj .dotest /.emacs-project +/.redcar config/database.yml config/site.yml config/deploy.rb diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index d0a558b18..5e413fedf 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -625,7 +625,7 @@ def calendar due_this_week_date = Time.zone.now.end_of_week due_next_week_date = due_this_week_date + 7.days due_this_month_date = Time.zone.now.end_of_month - + @due_today = current_user.todos.not_completed.find(:all, :include => [:taggings, :tags], :conditions => ['todos.due <= ?', due_today_date], @@ -646,7 +646,7 @@ def calendar :include => [:taggings, :tags], :conditions => ['todos.due > ?', due_this_month_date], :order => "due") - + @count = current_user.todos.not_completed.are_due.count respond_to do |format| @@ -1278,6 +1278,16 @@ def context_specified_by_name(context_name) return false if context_name.blank? 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 diff --git a/app/views/todos/destroy.js.erb b/app/views/todos/destroy.js.erb index 3b264ea95..86808c588 100644 --- a/app/views/todos/destroy.js.erb +++ b/app/views/todos/destroy.js.erb @@ -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 -%> } diff --git a/app/views/todos/update.js.erb b/app/views/todos/update.js.erb index 7d2e62ad9..c76d71b1d 100644 --- a/app/views/todos/update.js.erb +++ b/app/views/todos/update.js.erb @@ -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(); }); diff --git a/config/locales/nl.yml b/config/locales/nl.yml index a22fdb34a..fa1feb988 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -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 diff --git a/features/calendar.feature b/features/calendar.feature index ddc68106d..dee7ceccc 100644 --- a/features/calendar.feature +++ b/features/calendar.feature @@ -22,7 +22,7 @@ Feature: Show all due actions in a calendar view Then the badge should show 1 And I should see "a new next action" - @selenium + @selenium Scenario: Clearing the due date of a todo will remove it from the calendar When I go to the home page And I submit a new action with description "a new next action" in the context "@calendar" @@ -32,7 +32,7 @@ Feature: Show all due actions in a calendar view When I clear the due date of "a new next action" Then I should not see "a new next action" - @selenium + @selenium Scenario: Marking a todo complete will remove it from the calendar Given I have a todo "a new next action" in the context "@calendar" which is due tomorrow When I go to the calendar page