fix #1121 and add tests for this

This commit is contained in:
Reinier Balt 2011-03-10 16:50:19 +01:00
parent 3711acb6ab
commit b02bb3fdde
7 changed files with 70 additions and 13 deletions

View file

@ -904,7 +904,7 @@ class TodosController < ApplicationController
@target_context_count = current_user.projects.find(project_id).todos.active.count
}
from.calendar {
@target_context_count = count_old_due_empty(@new_due_id)
@target_context_count = @new_due_id.blank? ? 0 : count_old_due_empty(@new_due_id)
}
end
@remaining_in_context = current_user.contexts.find(context_id).todos(true).active.not_hidden.count if !@remaining_in_context

View file

@ -287,7 +287,7 @@ module TodosHelper
end
def date_field_tag(name, id, value = nil, options = {})
text_field_tag name, value, {"size" => 12, "id" => id, "class" => "Date", "onfocus" => "Calendar.setup", "autocomplete" => "off"}.update(options.stringify_keys)
text_field_tag name, value, {"size" => 12, "id" => id, "class" => "Date", "autocomplete" => "off"}.update(options.stringify_keys)
end
def update_needs_to_hide_context
@ -295,7 +295,7 @@ module TodosHelper
(@remaining_in_context == 0 && @todo_was_deferred_from_active_state) ||
(@remaining_in_context == 0 && @todo.completed? && !(@original_item_was_deferred || @original_item_was_hidden)) if source_view_is(:tag)
return false if source_view_is(:project)
return false if source_view_is_one_of(:project, :calendar)
return (@remaining_in_context == 0) && !source_view_is(:context)
end
@ -403,7 +403,7 @@ module TodosHelper
end
end
html += "}}) " * animation.count
return html
return html + ";"
end
private

View file

@ -19,7 +19,10 @@ function show_empty_messages() {
<% end -%>
<% if empty_container_msg_div_id && todo_container_is_empty -%>
$('#<%=empty_container_msg_div_id%>').slideDown(1000);
$('#<%=empty_container_msg_div_id%>').slideDown(1000);
<% if @down_count == 0 -%>
$('#no_todos_in_view').slideDown(1000);
<% end -%>
<% end -%>
<% if source_view_is(:deferred) && @down_count==0 -%>

View file

@ -7,7 +7,7 @@
animation = []
animation << "remove_todo"
if @todo.completed?
animation << "add_to_completed_container"
animation << "add_to_completed_container" unless source_view_is(:calendar)
animation << "add_new_recurring_todo"
animation << "activate_pending_todos"
animation << "remove_source_container"
@ -22,7 +22,8 @@
<% end -%>
function redirect_after_complete() {
redirect_to("<%= project_path(@todo.project) -%>");
var path = "<%= @todo.project_id.nil? ? "/" : project_path(@todo.project) -%>";
redirect_to(path);
}
function remove_todo(next_steps) {