mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-19 21:58:09 +01:00
get some further scenarios for adding todos to several pages
one is still failing, will get to that
This commit is contained in:
parent
ab2e51a51a
commit
8cbe077784
8 changed files with 118 additions and 32 deletions
|
|
@ -51,6 +51,7 @@ class TodosController < ApplicationController
|
|||
def create
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
@default_context = current_user.contexts.find_by_name(params['default_context_name'])
|
||||
@default_project = current_user.projects.find_by_name(params['default_project_name'])
|
||||
|
||||
@tag_name = params['_tag_name']
|
||||
|
||||
|
|
|
|||
|
|
@ -205,21 +205,23 @@ module TodosHelper
|
|||
end
|
||||
|
||||
def should_show_new_item
|
||||
return false if source_view_is(:todo) && @todo.hidden?
|
||||
return false if source_view_is(:context) && @todo.hidden? && !@todo.context.hidden?
|
||||
|
||||
return true if source_view_is(:tag) && (
|
||||
(@todo.pending? && @todo.tags.include?(@tag_name)) ||
|
||||
@todo.tags.include?(@tag_name) ||
|
||||
(@todo.starred? && @tag_name == Todo::STARRED_TAG_NAME))
|
||||
|
||||
return false if (source_view_is(:context) && !(@todo.context_id==@default_context.id) )
|
||||
|
||||
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?
|
||||
return true if source_view_is(:project) && @todo.pending?
|
||||
return true if !source_view_is(:deferred) && @todo.active?
|
||||
source_view do |page|
|
||||
page.todo { return !@todo.hidden? }
|
||||
page.deferred { return @todo.deferred? || @todo.pending? }
|
||||
page.context {
|
||||
return @todo.context_id==@default_context.id && (!@todo.hidden? && !@todo.context.hidden?)
|
||||
}
|
||||
page.tag {
|
||||
return ( (@todo.pending? && @todo.has_tag?(@tag_name)) ||
|
||||
(@todo.has_tag?(@tag_name)) ||
|
||||
(@todo.starred? && @tag_name == Todo::STARRED_TAG_NAME)
|
||||
)
|
||||
}
|
||||
page.project {
|
||||
return (@todo.active? && @todo.project && @todo.project.id == @default_project.id) ||
|
||||
(@todo.project.hidden? && @todo.project_hidden?) || @todo.deferred? || @todo.pending?
|
||||
}
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue