mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-07 17:58:50 +01:00
Eliminated rails deprecation warnings originating from todo_list. The last warning left is from the acts_as_taggable plugin.
Also fixed a couple of ajax bugs with the badge_count on the Project detail page. Updated Selenium tests for regression testing of these bugs. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@421 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
f828d4b3ff
commit
eb1709b053
5 changed files with 25 additions and 22 deletions
|
|
@ -162,14 +162,12 @@ class TodosController < ApplicationController
|
|||
params['item']['show_from'] = parse_date_per_user_prefs(params['item']['show_from'])
|
||||
end
|
||||
|
||||
|
||||
|
||||
@saved = @item.update_attributes params["item"]
|
||||
@context_changed = @original_item_context_id != @item.context_id
|
||||
@item_was_activated_from_deferred_state = @original_item_was_deferred && @item.active?
|
||||
if @context_changed then @remaining_undone_in_context = @user.contexts.find(@original_item_context_id).not_done_todos.length; end
|
||||
if @context_changed then @remaining_undone_in_context = @user.contexts.find(@original_item_context_id).not_done_todo_count; end
|
||||
@project_changed = @original_item_project_id != @item.project_id
|
||||
if (@project_changed && !@original_item_project_id.nil?) then @remaining_undone_in_project = @user.projects.find(@original_item_project_id).not_done_todos.length; end
|
||||
if (@project_changed && !@original_item_project_id.nil?) then @remaining_undone_in_project = @user.projects.find(@original_item_project_id).not_done_todo_count; end
|
||||
determine_down_count
|
||||
end
|
||||
|
||||
|
|
@ -196,7 +194,7 @@ class TodosController < ApplicationController
|
|||
determine_down_count
|
||||
source_view do |from|
|
||||
from.todo do
|
||||
@remaining_undone_in_context = @user.contexts.find(@context_id).not_done_todos.length
|
||||
@remaining_undone_in_context = @user.contexts.find(@context_id).not_done_todo_count
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -42,13 +42,13 @@ if @saved
|
|||
page.show("p#{@original_item_project_id}empty-nd") if (@remaining_undone_in_project == 0)
|
||||
page.insert_html :bottom, "tickler", :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page['tickler-empty-nd'].hide
|
||||
page.replace_html "badge_count", @remaining_undone_in_project
|
||||
page.replace_html "badge_count", @down_count
|
||||
elsif @item_was_activated_from_deferred_state
|
||||
page[@item].remove
|
||||
page['tickler-empty-nd'].show if (@deferred_count == 0)
|
||||
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page["p#{@item.project_id}empty-nd"].hide
|
||||
page.replace_html "badge_count", @remaining_undone_in_project
|
||||
page.replace_html "badge_count", @down_count
|
||||
else
|
||||
page.replace dom_id(@item), :partial => 'todos/item', :locals => { :parent_container_type => parent_container_type }
|
||||
page.visual_effect :highlight, dom_id(@item), :duration => 3
|
||||
|
|
|
|||
|
|
@ -14,30 +14,33 @@ module Tracks
|
|||
end
|
||||
|
||||
def find_not_done_todos(opts={})
|
||||
self.todos.find(:all, :conditions => not_done_conditions(opts),
|
||||
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC")
|
||||
with_not_done_scope(opts) do
|
||||
self.todos.find(:all, :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC")
|
||||
end
|
||||
end
|
||||
|
||||
def find_deferred_todos(opts={})
|
||||
self.todos.find(:all, :conditions => ["todos.state = ?", "deferred"],
|
||||
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC")
|
||||
self.todos.find_in_state(:all, :deferred, :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC")
|
||||
end
|
||||
|
||||
def not_done_conditions(opts)
|
||||
def find_done_todos
|
||||
self.todos.find_in_state(:all, :completed, :order => "todos.completed_at DESC", :limit => self.user.prefs.show_number_completed)
|
||||
end
|
||||
|
||||
def not_done_todo_count(opts={})
|
||||
with_not_done_scope(opts) do
|
||||
self.todos.count
|
||||
end
|
||||
end
|
||||
|
||||
def with_not_done_scope(opts={})
|
||||
conditions = ["todos.state = ?", 'active']
|
||||
if opts.has_key?(:include_project_hidden_todos) && (opts[:include_project_hidden_todos] == true)
|
||||
conditions = ["(todos.state = ? or todos.state = ?)", 'active', 'project_hidden']
|
||||
end
|
||||
conditions
|
||||
end
|
||||
|
||||
def find_done_todos
|
||||
self.todos.find(:all, :conditions => ["todos.state = ?", "completed"],
|
||||
:order => "todos.completed_at DESC", :limit => self.user.prefs.show_number_completed)
|
||||
end
|
||||
|
||||
def not_done_todo_count(opts={})
|
||||
self.todos.count(not_done_conditions(opts))
|
||||
self.todos.with_scope :find => {:conditions => conditions} do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
||||
def done_todo_count
|
||||
|
|
|
|||
|
|
@ -9,3 +9,4 @@ type "show_from_todo_15", ""
|
|||
click "//input[@value='Update']"
|
||||
wait_for_element_present "xpath=//div[@id='p1'] //div[@id='todo_15']"
|
||||
assert_not_visible "tickler-empty-nd"
|
||||
assert_text 'badge_count', '3'
|
||||
|
|
|
|||
|
|
@ -7,3 +7,4 @@ type "show_from_todo_5", "1/1/2030"
|
|||
click "//input[@value='Update']"
|
||||
wait_for_element_present "xpath=//div[@id='tickler'] //div[@id='todo_5']"
|
||||
assert_not_visible "tickler-empty-nd"
|
||||
assert_text 'badge_count', '1'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue