mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-28 01:54:07 +01:00
do a big refactor of rendering collections of todos for home page, tag page, project page, context page
This commit is contained in:
parent
f22dfc1f9b
commit
22b371ef8c
20 changed files with 910 additions and 816 deletions
|
|
@ -43,13 +43,13 @@ class ContextsController < ApplicationController
|
|||
@done = @context.todos.completed.limit(@max_completed).reorder("todos.completed_at DESC, todos.created_at DESC").includes(Todo::DEFAULT_INCLUDES)
|
||||
@not_done_todos = @context.todos.active.reorder("todos.due IS NULL, todos.due ASC, todos.created_at ASC").includes(Todo::DEFAULT_INCLUDES)
|
||||
|
||||
@deferred = @context.todos.deferred.includes(Todo::DEFAULT_INCLUDES)
|
||||
@pending = @context.todos.pending.includes(Todo::DEFAULT_INCLUDES)
|
||||
@deferred_todos = @context.todos.deferred.includes(Todo::DEFAULT_INCLUDES)
|
||||
@pending_todos = @context.todos.pending.includes(Todo::DEFAULT_INCLUDES)
|
||||
|
||||
@projects = current_user.projects
|
||||
@contexts = current_user.contexts
|
||||
|
||||
@count = @not_done_todos.count + @deferred.count + @pending.count
|
||||
@count = @not_done_todos.count + @deferred_todos.count + @pending_todos.count
|
||||
@page_title = "TRACKS::Context: #{@context.name}"
|
||||
respond_to do |format|
|
||||
format.html
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ class TodosController < ApplicationController
|
|||
def index
|
||||
@source_view = params['_source_view'] || 'todo'
|
||||
@group_view_by = cookies['group_view_by'] || 'context'
|
||||
@show_empty_containers = (cookies['show_empty_containers']=="true") || false
|
||||
|
||||
init_data_for_sidebar unless mobile?
|
||||
|
||||
@todos = current_user.todos.includes(Todo::DEFAULT_INCLUDES)
|
||||
|
|
@ -31,6 +33,7 @@ class TodosController < ApplicationController
|
|||
@page_title = t('todos.task_list_title')
|
||||
# Set count badge to number of not-done, not hidden context items
|
||||
@count = current_user.todos.active.not_hidden.count(:all)
|
||||
@todos_without_project = @not_done_todos.select{|t|t.project.nil?}
|
||||
end
|
||||
format.m do
|
||||
@page_title = t('todos.mobile_todos_page_title')
|
||||
|
|
@ -931,6 +934,7 @@ class TodosController < ApplicationController
|
|||
@tag_title = @single_tag ? @tag_name : tag_title(@tag_expr)
|
||||
|
||||
@group_view_by = cookies['group_view_by'] || 'context'
|
||||
@show_empty_containers = (cookies['show_empty_containers']=="true") || false
|
||||
end
|
||||
|
||||
def get_ids_from_tag_expr(tag_expr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue