mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-12 02:14:22 +01:00
make sure toggle_check and deleting of todos, recurring_todos and projects work in the new done views
This commit is contained in:
parent
35f947ec57
commit
6e97541ab3
10 changed files with 88 additions and 41 deletions
|
|
@ -702,13 +702,7 @@ class RecurringTodo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def toggle_completion!
|
||||
saved = false
|
||||
if completed?
|
||||
saved = activate!
|
||||
else
|
||||
saved = complete!
|
||||
end
|
||||
return saved
|
||||
return completed? ? activate! : complete!
|
||||
end
|
||||
|
||||
def toggle_star!
|
||||
|
|
|
|||
|
|
@ -210,13 +210,7 @@ class Todo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def toggle_completion!
|
||||
saved = false
|
||||
if completed?
|
||||
saved = activate!
|
||||
else
|
||||
saved = complete!
|
||||
end
|
||||
return saved
|
||||
return completed? ? activate! : complete!
|
||||
end
|
||||
|
||||
def show_from
|
||||
|
|
@ -287,14 +281,18 @@ class Todo < ActiveRecord::Base
|
|||
@predecessor_array << t
|
||||
end
|
||||
|
||||
# Return todos that should be activated if the current todo is completed
|
||||
def pending_to_activate
|
||||
return successors.find_all {|t| t.uncompleted_predecessors.empty?}
|
||||
# activate todos that should be activated if the current todo is completed
|
||||
def activate_pending_todos
|
||||
pending_todos = successors.find_all {|t| t.uncompleted_predecessors.empty?}
|
||||
pending_todos.each {|t| t.activate! }
|
||||
return pending_todos
|
||||
end
|
||||
|
||||
# Return todos that should be blocked if the current todo is undone
|
||||
def active_to_block
|
||||
return successors.find_all {|t| t.active? or t.deferred?}
|
||||
def block_successors
|
||||
active_successors = successors.find_all {|t| t.active? or t.deferred?}
|
||||
active_successors.each {|t| t.block!}
|
||||
return active_successors
|
||||
end
|
||||
|
||||
def raw_notes=(value)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue