mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 01:08:50 +01:00
Simple dependency handling working on project page.
The database contains actions with dependencies. Please rename to tracks-17-blank.db or update database path accordingly. Conflicts: app/views/todos/toggle_check.js.rjs
This commit is contained in:
parent
cb4ed7ff7f
commit
101df3fb6b
4 changed files with 26 additions and 6 deletions
|
|
@ -144,19 +144,25 @@ class TodosController < ApplicationController
|
|||
|
||||
if @todo.completed?
|
||||
logger.debug "completed #{@todo.description}"
|
||||
# A todo was completed - check for pending todos
|
||||
# A todo was completed - check for pending todos to activate
|
||||
@pending_to_activate = []
|
||||
@todo.successors.each do |t|
|
||||
if t.uncompleted_predecessors.empty? # Activate pending todos
|
||||
logger.debug "activated #{t.description}"
|
||||
t.activate!
|
||||
@pending_to_activate << t
|
||||
end
|
||||
end
|
||||
else
|
||||
# Block todos for undone actions - (it does no harm if they are already pending)
|
||||
# Block active successors for undone action
|
||||
@active_to_block = []
|
||||
logger.debug "undid #{@todo.description}"
|
||||
@todo.successors.each do |t|
|
||||
logger.debug "blocked #{t.description}"
|
||||
t.block!
|
||||
if t.state == 'active'
|
||||
logger.debug "blocked #{t.description}"
|
||||
t.block!
|
||||
@active_to_block << t
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ module TodosHelper
|
|||
def item_container_id (todo)
|
||||
if source_view_is :project
|
||||
return "p#{todo.project_id}items" if todo.active?
|
||||
return "tickler" if todo.deferred?
|
||||
return "tickler" if todo.deferred? or todo.pending?
|
||||
end
|
||||
return "c#{todo.context_id}items"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,9 +8,15 @@ if @saved
|
|||
page.insert_html :top, "completed_containeritems", :partial => 'todos/todo', :locals => { :todo => @todo, :parent_container_type => "completed" }
|
||||
page.visual_effect :highlight, dom_id(@todo, 'line'), {'startcolor' => "'#99ff99'"}
|
||||
page[empty_container_msg_div_id].show if @down_count == 0 && !empty_container_msg_div_id.nil?
|
||||
page.show 'tickler-empty-nd' if source_view_is(:project) && @deferred_count == 0
|
||||
page.show 'tickler-empty-nd' if source_view_is(:project) && @deferred_count == 0 && @pending_count == 0
|
||||
page.hide 'empty-d' # If we've checked something as done, completed items can't be empty
|
||||
end
|
||||
# Activate pending todos that are successors of the completed
|
||||
@pending_to_activate.each do |t|
|
||||
logger.debug "#300: Removing #{t.description} from pending block and adding it to active"
|
||||
page[t].remove
|
||||
page.insert_html :bottom, item_container_id(t), :partial => 'todos/todo', :locals => { :todo => t, :parent_container_type => parent_container_type }
|
||||
end
|
||||
|
||||
# remove container if empty
|
||||
if @remaining_in_context == 0 && source_view_is(:todo)
|
||||
|
|
@ -44,6 +50,14 @@ if @saved
|
|||
page.show "empty-d" if @completed_count == 0
|
||||
page.show "c"+@todo.context.id.to_s
|
||||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil? # If we've checked something as undone, incomplete items can't be empty
|
||||
# If active todos are successors of the reactivated todo they will be blocked
|
||||
@active_to_block.each do |t|
|
||||
logger.debug "#300: Block #{t.description} that are a successor of #{@todo.description}"
|
||||
page[t].remove # Remove it from active
|
||||
# Insert it in deferred/pending block
|
||||
logger.debug "Insert #{t.description} in deferred/pending block"
|
||||
page.insert_html :bottom, item_container_id(t), :partial => 'todos/todo', :locals => { :todo => t, :parent_container_type => parent_container_type }
|
||||
end
|
||||
end
|
||||
|
||||
page.hide "status"
|
||||
|
|
|
|||
BIN
db/tracks-17-test.db
Normal file
BIN
db/tracks-17-test.db
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue