mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 09:18:50 +01:00
Project and context view can now be grouped by context and project (using view menu)
This commit is contained in:
parent
591e20c9f1
commit
0a57a68a87
10 changed files with 34 additions and 15 deletions
|
|
@ -20,6 +20,7 @@ class ApplicationController < ActionController::Base
|
|||
before_filter :set_time_zone
|
||||
before_filter :set_zindex_counter
|
||||
before_filter :set_locale
|
||||
append_before_filter :set_group_view_by
|
||||
prepend_before_filter :login_required
|
||||
prepend_before_filter :enable_mobile_content_negotiation
|
||||
after_filter :set_charset
|
||||
|
|
@ -290,4 +291,8 @@ class ApplicationController < ActionController::Base
|
|||
render :template => 'todos/done'
|
||||
end
|
||||
|
||||
def set_group_view_by
|
||||
@group_view_by = params['_group_view_by'] || cookies['group_view_by'] || 'context'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class ContextsController < ApplicationController
|
|||
@max_completed = current_user.prefs.show_number_completed
|
||||
@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)
|
||||
@todos_without_project = @not_done_todos.select{|t| t.project.nil?}
|
||||
|
||||
@deferred_todos = @context.todos.deferred.includes(Todo::DEFAULT_INCLUDES)
|
||||
@pending_todos = @context.todos.pending.includes(Todo::DEFAULT_INCLUDES)
|
||||
|
|
@ -49,6 +50,9 @@ class ContextsController < ApplicationController
|
|||
@projects = current_user.projects
|
||||
@contexts = current_user.contexts
|
||||
|
||||
@projects_to_show = @projects.active
|
||||
@contexts_to_show = [@context]
|
||||
|
||||
@count = @not_done_todos.count + @deferred_todos.count + @pending_todos.count
|
||||
@page_title = "TRACKS::Context: #{@context.name}"
|
||||
respond_to do |format|
|
||||
|
|
|
|||
|
|
@ -131,12 +131,14 @@ class ProjectsController < ApplicationController
|
|||
@not_done_todos = @project.todos.active_or_hidden.includes(Todo::DEFAULT_INCLUDES)
|
||||
@deferred_todos = @project.todos.deferred.includes(Todo::DEFAULT_INCLUDES)
|
||||
@pending_todos = @project.todos.pending.includes(Todo::DEFAULT_INCLUDES)
|
||||
@contexts_to_show = current_user.contexts.active
|
||||
@projects_to_show = [@project]
|
||||
|
||||
@done = {}
|
||||
@done = @project.todos.completed.
|
||||
reorder("todos.completed_at DESC").
|
||||
limit(current_user.prefs.show_number_completed).
|
||||
includes(Todo::DEFAULT_INCLUDES) unless current_user.prefs.show_number_completed == 0
|
||||
includes(Todo::DEFAULT_INCLUDES) unless @max_completed == 0
|
||||
|
||||
@count = @not_done_todos.size
|
||||
@down_count = @count + @deferred_todos.size + @pending_todos.size
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ class TodosController < ApplicationController
|
|||
skip_before_filter :login_required, :only => [:index, :tag]
|
||||
prepend_before_filter :login_or_feed_token_required, :only => [:index, :tag]
|
||||
append_before_filter :find_and_activate_ready, :only => [:index, :list_deferred]
|
||||
append_before_filter :set_group_view_by, :only => [:index, :tag, :create, :list_deferred, :destroy, :defer, :update, :toggle_check]
|
||||
|
||||
protect_from_forgery :except => :check_deferred
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue