mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
cleanup debug messages
This commit is contained in:
parent
f923a40a40
commit
7a893980c2
4 changed files with 41 additions and 57 deletions
|
|
@ -161,9 +161,7 @@ class TodosController < ApplicationController
|
|||
:description => line)
|
||||
@todo.project_id = @project_id
|
||||
@todo.context_id = @context_id
|
||||
puts "TODO: #{@todo.description}, #{@todo.project_id}, #{@todo.context_id}"
|
||||
@saved = @todo.save
|
||||
puts "NOT SAVED" unless @saved
|
||||
unless (@saved == false) || tag_list.blank?
|
||||
@todo.tag_with(tag_list)
|
||||
@todo.tags.reload
|
||||
|
|
@ -837,8 +835,8 @@ class TodosController < ApplicationController
|
|||
source_view do |from|
|
||||
from.deferred {
|
||||
# force reload to todos to get correct count and not a cached one
|
||||
@remaining_in_context = current_user.contexts.find(context_id).todos(true).deferred_or_blocked.count
|
||||
@target_context_count = current_user.contexts.find(@todo.context_id).todos(true).deferred_or_blocked.count
|
||||
@remaining_in_context = current_user.contexts.find(context_id).todos.deferred_or_blocked.count
|
||||
@target_context_count = current_user.contexts.find(@todo.context_id).todos.deferred_or_blocked.count
|
||||
}
|
||||
from.tag {
|
||||
tag = Tag.find_by_name(params['_tag_name'])
|
||||
|
|
@ -860,12 +858,8 @@ class TodosController < ApplicationController
|
|||
@target_context_count = count_old_due_empty(@new_due_id)
|
||||
}
|
||||
end
|
||||
@remaining_in_context = current_user.contexts.find(context_id).not_done_todo_count if !@remaining_in_context
|
||||
@target_context_count = current_user.contexts.find(@todo.context_id).not_done_todo_count if !@target_context_count
|
||||
puts "@remaining_in_context = #{@remaining_in_context}"
|
||||
puts "@target_context_count = #{@target_context_count}"
|
||||
puts "@remaining_hidden_count = #{@remaining_hidden_count}"
|
||||
puts "@remaining_deferred_or_pending_count = #{@remaining_deferred_or_pending_count}"
|
||||
@remaining_in_context = current_user.contexts.find(context_id).todos(true).not_hidden.count if !@remaining_in_context
|
||||
@target_context_count = current_user.contexts.find(@todo.context_id).todos(true).not_hidden.count if !@target_context_count
|
||||
end
|
||||
|
||||
def determine_completed_count
|
||||
|
|
@ -1156,7 +1150,6 @@ class TodosController < ApplicationController
|
|||
@original_item_due = @todo.due
|
||||
@original_item_due_id = get_due_id_for_calendar(@todo.due)
|
||||
@original_item_predecessor_list = @todo.predecessors.map{|t| t.specification}.join(', ')
|
||||
puts "wh = #{@original_item_was_hidden}"
|
||||
end
|
||||
|
||||
def update_project
|
||||
|
|
@ -1198,7 +1191,6 @@ class TodosController < ApplicationController
|
|||
params["todo"]["context_id"] = context.id
|
||||
end
|
||||
@context_changed = @original_item_context_id != params["todo"]["context_id"] = context.id
|
||||
puts "context changed into '#{context.name}'"
|
||||
end
|
||||
|
||||
def update_tags
|
||||
|
|
@ -1259,13 +1251,6 @@ class TodosController < ApplicationController
|
|||
@due_date_changed = @original_item_due != @todo.due
|
||||
@todo_hidden_state_changed = @original_item_was_hidden != @todo.hidden?
|
||||
|
||||
puts "@context_changed = #{@context_changed}"
|
||||
puts "@project_changed = #{@project_changed}"
|
||||
puts "@todo_was_activated_from_deferred_state #{@todo_was_activated_from_deferred_state}"
|
||||
puts "@todo_was_deferred_from_active_state = #{@todo_was_deferred_from_active_state}"
|
||||
puts "@due_date_changed = #{@due_date_changed}"
|
||||
puts "@todo_hidden_state_changed = #{@todo_hidden_state_changed} @todo.hidden?=#{@todo.hidden?}"
|
||||
|
||||
source_view do |page|
|
||||
page.calendar do
|
||||
@old_due_empty = is_old_due_empty(@original_item_due_id)
|
||||
|
|
@ -1274,7 +1259,6 @@ class TodosController < ApplicationController
|
|||
page.tag do
|
||||
@tag_name = params['_tag_name']
|
||||
@tag_was_removed = !@todo.has_tag?(@tag_name)
|
||||
puts "@tag_was_removed = #{@tag_was_removed}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ module TodosHelper
|
|||
page.calendar { return @due_date_changed || !@todo.due }
|
||||
page.stats { return @todo.completed? }
|
||||
page.tag { return (@context_changed && !@todo.hidden?) || @tag_was_removed || @todo_hidden_state_changed || @todo_deferred_state_changed }
|
||||
page.todo { return @context_changed || @todo.hidden? || @todo.deferred? || @todo.pending?}
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
|
@ -288,6 +289,7 @@ module TodosHelper
|
|||
page.calendar { return !@due_date_changed && @todo.due }
|
||||
page.stats { return !@todo.completed? }
|
||||
page.tag { return !update_needs_to_remove_todo_from_container && !@tag_was_removed }
|
||||
page.todo { return !update_needs_to_remove_todo_from_container }
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
|
@ -300,21 +302,20 @@ module TodosHelper
|
|||
page.calendar { return @due_date_changed && @todo.due }
|
||||
page.stats { return false }
|
||||
page.tag { return update_needs_to_remove_todo_from_container && !@tag_was_removed}
|
||||
page.todo { return @context_changed && !(@todo.deferred? || @todo.pending? || @todo.hidden?) }
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
def item_container_id (todo)
|
||||
puts "todo.hidden?=#{todo.hidden?} en source_view=#{@source_view}"
|
||||
return "hiddenitems" if source_view_is(:tag) && todo.hidden?
|
||||
return "c#{todo.context_id}items" if source_view_is :deferred
|
||||
return @new_due_id if source_view_is :calendar
|
||||
return "tickleritems" if todo.deferred? || todo.pending?
|
||||
return "tickleritems" if !source_view_is(:todo) && (todo.deferred? || todo.pending?)
|
||||
return "p#{todo.project_id}items" if source_view_is :project
|
||||
return "c#{todo.context_id}items"
|
||||
end
|
||||
|
||||
|
||||
def empty_container_msg_div_id(todo = @todo || @successor)
|
||||
raise Exception.new, "no @todo or @successor set" if !todo
|
||||
|
||||
|
|
@ -336,6 +337,25 @@ module TodosHelper
|
|||
return "c#{todo.context_id}empty-nd"
|
||||
end
|
||||
|
||||
def show_empty_message_in_source_container
|
||||
container_id = ""
|
||||
source_view do |page|
|
||||
page.project {
|
||||
container_id = "p#{@original_item_project_id}empty-nd" if @remaining_in_context == 0
|
||||
container_id = "tickler-empty-nd" if @todo_was_activated_from_deferred_state && @remaining_deferred_or_pending_count == 0
|
||||
}
|
||||
page.deferred { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
|
||||
page.calendar { container_id = "empty_#{@original_item_due_id}" if @old_due_empty }
|
||||
page.tag {
|
||||
container_id = "hidden-empty-nd" if !@todo.hidden? && @todo_hidden_state_changed && @remaining_hidden_count == 0
|
||||
container_id = "tickler-empty-nd" if @todo_was_activated_from_deferred_state && @remaining_deferred_or_pending_count == 0
|
||||
}
|
||||
page.context { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
|
||||
page.todo { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
|
||||
end
|
||||
return container_id.blank? ? "" : "$(\"##{container_id}\").slideDown(100);"
|
||||
end
|
||||
|
||||
def render_animation(animation)
|
||||
html = ""
|
||||
animation.each do |step|
|
||||
|
|
|
|||
|
|
@ -28,11 +28,12 @@ class Todo < ActiveRecord::Base
|
|||
named_scope :of_user, lambda { |user_id| {:conditions => ["todos.user_id = ? ", user_id] } }
|
||||
named_scope :hidden,
|
||||
:joins => :context,
|
||||
:conditions => ["todos.state = ? OR (contexts.hide = ? AND (todos.state = ? OR todos.state = ?))",
|
||||
'project_hidden', true, 'active', 'deferred']
|
||||
:conditions => ["todos.state = ? OR (contexts.hide = ? AND (todos.state = ? OR todos.state = ? OR todos.state = ?))",
|
||||
'project_hidden', true, 'active', 'deferred', 'pending']
|
||||
named_scope :not_hidden,
|
||||
:joins => [:context, :project],
|
||||
:conditions => ['contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', false, 'active']
|
||||
:conditions => ['NOT(todos.state = ? OR (contexts.hide = ? AND (todos.state = ? OR todos.state = ? OR todos.state = ?)))',
|
||||
'project_hidden', true, 'active', 'deferred', 'pending']
|
||||
|
||||
STARRED_TAG_NAME = "starred"
|
||||
|
||||
|
|
@ -210,12 +211,10 @@ class Todo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def hidden?
|
||||
puts "hidden => state = #{self.state} context(#{self.context.name}).hidden=#{self.context.hidden?}"
|
||||
return self.state == 'project_hidden' || ( self.context.hidden? && (self.state == 'active' || self.state == 'deferred'))
|
||||
end
|
||||
|
||||
def update_state_from_project
|
||||
puts "state was #{self.state}; project.hidden?=#{self.project.hidden?}"
|
||||
if state == 'project_hidden' and !self.project.hidden?
|
||||
if self.uncompleted_predecessors.empty?
|
||||
self.state = 'active'
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
TracksPages.show_edit_errors(html_for_error_messages());
|
||||
<% else
|
||||
|
||||
# jquery animations are async, so first collect all animation steps,
|
||||
# then execute them sequential. All steps are functions which are passed a function
|
||||
# with the next animation steps
|
||||
# jquery animations are async, so first collect all animation steps that need
|
||||
# to be run sequential,then execute them. All steps are functions which are
|
||||
# passed a function as parameter that will execute the next animation steps
|
||||
|
||||
animation = []
|
||||
animation << "remove_todo" if update_needs_to_remove_todo_from_container
|
||||
|
|
@ -25,26 +25,7 @@
|
|||
function remove_todo(next_steps) {
|
||||
$('#<%= dom_id(@todo) %>').fadeOut(400, function() {
|
||||
$('#<%= dom_id(@todo) %>').remove();
|
||||
|
||||
<% # TODO: to helper function: show_empty_message_source_container
|
||||
container_id = ""
|
||||
source_view do |page|
|
||||
page.project {
|
||||
container_id = "p#{@original_item_project_id}empty-nd" if @remaining_in_context == 0
|
||||
container_id = "tickler-empty-nd" if @todo_was_activated_from_deferred_state && @remaining_deferred_or_pending_count == 0
|
||||
}
|
||||
page.deferred { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
|
||||
page.calendar { container_id = "empty_#{@original_item_due_id}" if @old_due_empty }
|
||||
page.tag {
|
||||
container_id = "hidden-empty-nd" if !@todo.hidden? && @todo_hidden_state_changed && @remaining_hidden_count == 0
|
||||
container_id = "tickler-empty-nd" if @todo_was_activated_from_deferred_state && @remaining_deferred_or_pending_count == 0
|
||||
}
|
||||
page.context { container_id = "c#{@original_item_context_id}empty-nd" if @remaining_in_context == 0 }
|
||||
end
|
||||
unless container_id.blank?
|
||||
-%>
|
||||
$("#<%= container_id%>").slideDown(100);
|
||||
<% end -%>
|
||||
<%= show_empty_message_in_source_container -%>
|
||||
next_steps.go();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue