mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 01:08:50 +01:00
fixes #660. New todos that belong to hidden or completed project are not added to home page or context page.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@744 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
922bcc2b3a
commit
ab2f0f8201
3 changed files with 19 additions and 11 deletions
|
|
@ -166,7 +166,7 @@ class ContextsController < ApplicationController
|
|||
# search manually until I can work out a way to do the same thing using
|
||||
# not_done_todos acts_as_todo_container method Hides actions in hidden
|
||||
# projects from context.
|
||||
@not_done_todos = @context.todos.find(:all, :conditions => ['todos.state = ?', 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [:project, :tags])
|
||||
@not_done_todos = @context.todos.find(:all, :conditions => ['todos.state = ? AND projects.state = ?', 'active', 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [:project, :tags])
|
||||
@count = @not_done_todos.size
|
||||
@default_project_context_name_map = build_default_project_context_name_map(@projects).to_json
|
||||
end
|
||||
|
|
|
|||
|
|
@ -414,7 +414,7 @@ class TodosController < ApplicationController
|
|||
@todos = Todo.find(:all, :conditions => ['todos.user_id = ? and todos.state = ? or todos.state = ?', current_user.id, 'active', 'completed'], :include => [ :project, :context, :tags ])
|
||||
|
||||
# Exclude hidden projects from the home page
|
||||
@not_done_todos = Todo.find(:all, :conditions => ['todos.user_id = ? and todos.state = ? and projects.state = ?', current_user.id, 'active', 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [ :project, :context, :tags ])
|
||||
@not_done_todos = Todo.find(:all, :conditions => ['todos.user_id = ? and todos.state = ? AND (projects.state = ? OR todos.project_id IS NULL)', current_user.id, 'active', 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [ :project, :context, :tags ])
|
||||
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
module TodosHelper
|
||||
|
||||
#require 'users_controller'
|
||||
# Counts the number of incomplete items in the specified context
|
||||
# #require 'users_controller' Counts the number of incomplete items in the
|
||||
# specified context
|
||||
#
|
||||
def count_items(context)
|
||||
count = Todo.find_all("done=0 AND context_id=#{context.id}").length
|
||||
|
|
@ -14,12 +14,12 @@ module TodosHelper
|
|||
:id => dom_id(@todo, 'form'),
|
||||
:class => dom_id(@todo, 'form') + " inline-form edit_todo_form" },
|
||||
&block )
|
||||
apply_behavior 'form.edit_todo_form', make_remote_form(
|
||||
:method => :put,
|
||||
:before => "this.down('button.positive').startWaiting()",
|
||||
:loaded => "this.down('button.positive').stopWaiting()",
|
||||
:condition => "!(this.down('button.positive').isWaiting())"),
|
||||
:prevent_default => true
|
||||
apply_behavior 'form.edit_todo_form', make_remote_form(
|
||||
:method => :put,
|
||||
:before => "this.down('button.positive').startWaiting()",
|
||||
:loaded => "this.down('button.positive').stopWaiting()",
|
||||
:condition => "!(this.down('button.positive').isWaiting())"),
|
||||
:prevent_default => true
|
||||
end
|
||||
|
||||
def remote_delete_icon
|
||||
|
|
@ -79,7 +79,7 @@ module TodosHelper
|
|||
end
|
||||
apply_behavior '.item-container input.item-checkbox:click',
|
||||
remote_function(:url => javascript_variable('this.value'), :method => 'put',
|
||||
:with => parameters)
|
||||
:with => parameters)
|
||||
str
|
||||
end
|
||||
|
||||
|
|
@ -196,6 +196,14 @@ module TodosHelper
|
|||
end
|
||||
|
||||
def should_show_new_item
|
||||
|
||||
if @todo.project.nil? == false
|
||||
# do not show new actions that were added to hidden or completed projects
|
||||
# on home page and context page
|
||||
return false if source_view_is(:todo) && (@todo.project.hidden? || @todo.project.completed?)
|
||||
return false if source_view_is(:context) && (@todo.project.hidden? || @todo.project.completed?)
|
||||
end
|
||||
|
||||
return true if source_view_is(:deferred) && @todo.deferred?
|
||||
return true if source_view_is(:project) && @todo.project.hidden? && @todo.project_hidden?
|
||||
return true if source_view_is(:project) && @todo.deferred?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue