mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-21 17:50:13 +01:00
start on done overview page
This commit is contained in:
parent
01057af684
commit
559a02d6f1
10 changed files with 127 additions and 32 deletions
|
|
@ -81,23 +81,19 @@ class ApplicationController < ActionController::Base
|
|||
#
|
||||
def count_undone_todos_phrase(todos_parent, string="actions")
|
||||
count = count_undone_todos(todos_parent)
|
||||
if count == 1
|
||||
word = string.singularize
|
||||
else
|
||||
word = string.pluralize
|
||||
end
|
||||
word = count == 1 ? string.singularize : string.pluralize
|
||||
return count.to_s + " " + word
|
||||
end
|
||||
|
||||
def count_undone_todos(todos_parent)
|
||||
if todos_parent.nil?
|
||||
count = 0
|
||||
elsif (todos_parent.is_a?(Project) && todos_parent.hidden?)
|
||||
return 0 if todos_parent.nil?
|
||||
|
||||
if (todos_parent.is_a?(Project) && todos_parent.hidden?)
|
||||
count = eval "@project_project_hidden_todo_counts[#{todos_parent.id}]"
|
||||
else
|
||||
count = eval "@#{todos_parent.class.to_s.downcase}_not_done_counts[#{todos_parent.id}]"
|
||||
end
|
||||
count || 0
|
||||
|
||||
end
|
||||
|
||||
# Convert a date object to the format specified in the user's preferences in
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class StatsController < ApplicationController
|
||||
|
||||
helper :todos
|
||||
helper :todos, :projects
|
||||
|
||||
append_before_filter :init, :exclude => []
|
||||
|
||||
|
|
@ -643,6 +643,18 @@ class StatsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def done
|
||||
@source_view = 'done'
|
||||
|
||||
@done_recently = current_user.todos.completed.all(:limit => 10, :order => 'completed_at DESC')
|
||||
|
||||
init_not_done_counts(['project'])
|
||||
@last_completed_projects = current_user.projects.completed.all(:limit => 10, :order => 'completed_at DESC')
|
||||
|
||||
@last_completed_contexts = []
|
||||
#@last_completed_contexts = current_user.contexts.completed.all(:limit => 10, :order => 'completed_at DESC')
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_unique_tags_of_user
|
||||
|
|
|
|||
|
|
@ -471,14 +471,30 @@ class TodosController < ApplicationController
|
|||
def done
|
||||
@source_view = 'done'
|
||||
@page_title = t('todos.completed_tasks_title')
|
||||
|
||||
completed_todos = current_user.todos.completed
|
||||
@done_today = completed_todos.completed_after(Time.zone.now.beginning_of_day)
|
||||
@done_this_week = completed_todos.completed_after(Time.zone.now.beginning_of_week)-@done_today
|
||||
@done_this_month = completed_todos.completed_after(Time.zone.now.beginning_of_month)-@done_this_week
|
||||
@done_previous_month = completed_todos.completed_after( (Time.zone.now.beginning_of_month - 1.day).beginning_of_month)-@done_this_month
|
||||
start_of_this_day = Time.zone.now.beginning_of_day
|
||||
start_of_this_week = Time.zone.now.beginning_of_week
|
||||
start_of_this_month = Time.zone.now.beginning_of_month
|
||||
start_of_previous_month = (Time.zone.now.beginning_of_month - 1.day).beginning_of_month
|
||||
includes = {:include => [:context, :project, :tags, :taggings, :successors, :predecessors]}
|
||||
|
||||
@done_today = completed_todos.completed_after(start_of_this_day).all(includes)
|
||||
@done_this_week = completed_todos.completed_after(start_of_this_week).completed_before(start_of_this_day).all(includes)
|
||||
@done_this_month = completed_todos.completed_after(start_of_this_month).completed_before(start_of_this_week).all(includes)
|
||||
@count = @done_today.size + @done_this_week.size + @done_this_month.size
|
||||
end
|
||||
|
||||
def all_done
|
||||
@source_view = 'done'
|
||||
@page_title = t('todos.completed_tasks_title')
|
||||
|
||||
includes = [:context, :project, :tags, :taggings, :successors, :predecessors]
|
||||
|
||||
@done = current_user.todos.completed.paginate :page => params[:page], :per_page => 20, :order => 'completed_at DESC', :include => includes
|
||||
@count = @done.size
|
||||
end
|
||||
|
||||
def list_deferred
|
||||
@source_view = 'deferred'
|
||||
@page_title = t('todos.deferred_tasks_title')
|
||||
|
|
@ -961,7 +977,7 @@ class TodosController < ApplicationController
|
|||
# If you've set no_completed to zero, the completed items box isn't shown
|
||||
# on the home page
|
||||
max_completed = current_user.prefs.show_number_completed
|
||||
@done = current_user.completed_todos.find(:all, :limit => max_completed, :include => [ :context, :project, :tags ]) unless max_completed == 0
|
||||
@done = current_user.todos.completed.find(:all, :limit => max_completed, :include => [ :context, :project, :tags ]) unless max_completed == 0
|
||||
|
||||
# Set count badge to number of not-done, not hidden context items
|
||||
@count = current_user.todos.active.not_hidden.count(:all)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ class UsersController < ApplicationController
|
|||
|
||||
# GET /users GET /users.xml
|
||||
def index
|
||||
@users = User.find(:all, :order => 'login')
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
@page_title = "TRACKS::Manage Users"
|
||||
|
|
@ -15,7 +14,10 @@ class UsersController < ApplicationController
|
|||
# we get returned here when signup is successful
|
||||
store_location
|
||||
end
|
||||
format.xml { render :xml => @users.to_xml(:except => [ :password ]) }
|
||||
format.xml do
|
||||
@users = User.find(:all, :order => 'login')
|
||||
render :xml => @users.to_xml(:except => [ :password ])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
44
app/views/stats/done.html.erb
Normal file
44
app/views/stats/done.html.erb
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<div id="display_box">
|
||||
<div class="container">
|
||||
<div class=add_note_link><%= link_to "Show all", done_todos_path%></div>
|
||||
<h2>
|
||||
<%= t('common.last') %> <%= t('states.completed_plural' )%> <%= t('common.actions') %>
|
||||
</h2>
|
||||
<% if @done_recently.empty? -%>
|
||||
<div class="message"><p><%= t('todos.no_last_completed_actions') %></p></div>
|
||||
<% else -%>
|
||||
<%= render :partial => "todos/todo", :collection => @done_recently, :locals => { :parent_container_type => "completed", :suppress_context => false, :suppress_project => false } %>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class=add_note_link><%= link_to "Show all", done_projects_path%></div>
|
||||
<h2>
|
||||
<%= t('common.last') %> <%= t('states.completed_plural' )%> <%= t('common.projects') %>
|
||||
</h2>
|
||||
<% if @last_completed_projects.empty? -%>
|
||||
<div class="message"><p><%= t('projects.no_last_completed_projects') %></p></div>
|
||||
<% else -%>
|
||||
<div id="list-completed-projects" class="project-list">
|
||||
<%= render :partial => '/projects/project_listing',
|
||||
:collection => @last_completed_projects,
|
||||
:locals => {:suppress_drag_handle => true}
|
||||
%>
|
||||
</div>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div class=add_note_link><%= link_to "Show all", done_contexts_path%></div>
|
||||
<h2>
|
||||
<%= t('common.last') %> <%= t('states.completed_plural' )%> <%= t('common.contexts') %>
|
||||
</h2>
|
||||
<% if @last_completed_contexts.empty? -%>
|
||||
<div class="message"><p><%= t('projects.no_last_completed_contexts') %></p></div>
|
||||
<% else -%>
|
||||
TODO
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
|
||||
</div><!-- End of display_box -->
|
||||
22
app/views/todos/all_done.html.erb
Normal file
22
app/views/todos/all_done.html.erb
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<%
|
||||
paginate_options = {
|
||||
:class => :add_note_link,
|
||||
:previous_label => '« '+ t('common.previous'),
|
||||
:next_label => t('common.next')+' »',
|
||||
:inner_window => 2
|
||||
}
|
||||
%>
|
||||
<div id="display_box_projects">
|
||||
<div class="container">
|
||||
<%= will_paginate @done, paginate_options %>
|
||||
<h2><%= t('todos.all_completed') %></h2>
|
||||
<% if @done.empty? -%>
|
||||
<div class="message"><p><%= t('todos.no_completed_actions') %></p></div>
|
||||
<% else -%>
|
||||
<%= render :partial => "todos/todo", :collection => @done, :locals => { :parent_container_type => "completed", :suppress_context => false, :suppress_project => false } %>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<%= will_paginate @done, paginate_options %>
|
||||
|
||||
</div><!-- End of display_box -->
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('todos.completed_rest_of_month', :month_name => 'TODO') %></h2>
|
||||
<h2><%= t('todos.completed_rest_of_month') %></h2>
|
||||
<% if @done_this_month.empty? -%>
|
||||
<div class="message"><p><%= t('todos.no_completed_actions') %></p></div>
|
||||
<% else -%>
|
||||
|
|
@ -26,14 +26,6 @@
|
|||
<% end -%>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('todos.completed_rest_of_previous_month', :month_name => 'TODO2') %></h2>
|
||||
<% if @done_previous_month.empty? -%>
|
||||
<div class="message"><p><%= t('todos.no_completed_actions') %></p></div>
|
||||
<% else -%>
|
||||
<%= render :partial => "todos/todo", :collection => @done_previous_month, :locals => { :parent_container_type => "completed", :suppress_context => false, :suppress_project => false } %>
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
<p>You can see all completed actions <%= link_to "here", all_done_todos_path %></p>
|
||||
|
||||
</div><!-- End of display_box -->
|
||||
|
|
|
|||
|
|
@ -62,6 +62,9 @@ en:
|
|||
cancel: "Cancel"
|
||||
ok: "Ok"
|
||||
add: "Add"
|
||||
previous: "Previous"
|
||||
next: "Next"
|
||||
last: "Last"
|
||||
project: "Project"
|
||||
projects: "Projects"
|
||||
context: "Context"
|
||||
|
|
@ -288,6 +291,7 @@ en:
|
|||
actions_in_project_title: "Actions in this project"
|
||||
notes: "Notes"
|
||||
notes_empty: "There are no notes for this project"
|
||||
no_last_completed_projects: "No completed projects found"
|
||||
settings: "Settings"
|
||||
state: "This project is %{state}"
|
||||
this_project: "This project"
|
||||
|
|
@ -468,6 +472,7 @@ en:
|
|||
no_deferred_actions_with: "No deferred actions with the tag '%{tag_name}'"
|
||||
completed_actions_with: "Completed actions with the tag %{tag_name}"
|
||||
no_completed_actions_with: "No completed actions with the tag '%{tag_name}'"
|
||||
no_last_completed_actions: "No completed actions found"
|
||||
next_action_description: "Next action description"
|
||||
new_related_todo_created: "A new todo was added which belongs to this recurring todo"
|
||||
new_related_todo_created_short: "created a new todo"
|
||||
|
|
@ -660,6 +665,7 @@ en:
|
|||
completed_rest_of_week: "Completed in the rest of this week"
|
||||
completed_rest_of_month: "Completed in the rest of this month"
|
||||
completed_rest_of_previous_month: "Completed in the rest of the previous month"
|
||||
all_completed: "All completed actions"
|
||||
added_new_next_action: "Added new next action"
|
||||
added_new_next_action_singular: "Added new next action"
|
||||
added_new_next_action_plural: "Added new next actions"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
contexts.done 'contexts/done', :action => 'completed'
|
||||
end
|
||||
|
||||
map.resources :projects, :collection => {:order => :post, :alphabetize => :post, :actionize => :post} do |projects|
|
||||
map.resources :projects, :collection => {:order => :post, :alphabetize => :post, :actionize => :post, :done => :get} do |projects|
|
||||
projects.resources :todos, :name_prefix => "project_"
|
||||
end
|
||||
|
||||
|
|
@ -28,7 +28,8 @@ ActionController::Routing::Routes.draw do |map|
|
|||
|
||||
map.resources :todos,
|
||||
:member => {:toggle_check => :put, :toggle_star => :put},
|
||||
:collection => {:check_deferred => :post, :filter_to_context => :post, :filter_to_project => :post, :done => :get}
|
||||
:collection => {:check_deferred => :post, :filter_to_context => :post, :filter_to_project => :post,
|
||||
:done => :get, :all_done => :get}
|
||||
|
||||
map.with_options :controller => :todos do |todos|
|
||||
todos.home '', :action => "index"
|
||||
|
|
@ -83,7 +84,12 @@ ActionController::Routing::Routes.draw do |map|
|
|||
end
|
||||
|
||||
map.preferences 'preferences', :controller => 'preferences', :action => 'index'
|
||||
map.stats 'stats', :controller => 'stats', :action => 'index'
|
||||
|
||||
map.with_options :controller => :stats do |stats|
|
||||
stats.stats_page 'stats', :action => 'index'
|
||||
stats.done_overview 'done', :action => 'done'
|
||||
end
|
||||
|
||||
map.search 'search', :controller => 'search', :action => 'index'
|
||||
map.data 'data', :controller => 'data', :action => 'index'
|
||||
map.done 'done', :controller => 'todos', :action => 'completed_overview'
|
||||
|
|
|
|||
|
|
@ -721,12 +721,12 @@ li {
|
|||
padding-top:10px;
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.sortable_row {
|
||||
background: #fff;
|
||||
_background: transparent; /* the underscore is only used by ie6 and below */
|
||||
padding: 4px 4px 4px 8px;
|
||||
margin: 2px 2px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.edit-form {
|
||||
|
|
@ -769,7 +769,6 @@ div.buttons, div.buttons a, div.buttons a:hover {
|
|||
|
||||
div#list-active-projects, div#list-hidden-projects, div#list-completed-projects, div#list-contexts, div#projects-empty-nd {
|
||||
clear:right;
|
||||
border: 1px solid #999;
|
||||
}
|
||||
|
||||
.project-state-group h2, .list-stategroup-contexts-container h2 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue