mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Fixed the count of undone items on the main page again, after breaking it ;-)
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@11 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
f7b77f6fd9
commit
3c196c46d8
6 changed files with 9 additions and 6 deletions
|
|
@ -44,7 +44,8 @@ class ContextController < ApplicationController
|
||||||
@places = Context.find_all
|
@places = Context.find_all
|
||||||
@projects = Project.find_all
|
@projects = Project.find_all
|
||||||
@page_title = "Context: #{@context.name.capitalize}"
|
@page_title = "Context: #{@context.name.capitalize}"
|
||||||
@not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created DESC" )
|
@not_done = Todo.find_all( "context_id=#{@context.id} AND done=0", "created ASC" )
|
||||||
|
@count = Todo.count( "context_id=#{@context.id} AND done=0" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ class ProjectController < ApplicationController
|
||||||
@places = Context.find_all
|
@places = Context.find_all
|
||||||
@page_title = "Project: #{@project.name}"
|
@page_title = "Project: #{@project.name}"
|
||||||
@not_done = Todo.find_all( "project_id=#{@project.id} AND done=0", "created DESC" )
|
@not_done = Todo.find_all( "project_id=#{@project.id} AND done=0", "created DESC" )
|
||||||
|
@count = Todo.count( "project_id=#{@project.id} AND done=0" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ class TodoController < ApplicationController
|
||||||
helper :todo
|
helper :todo
|
||||||
model :context, :project
|
model :context, :project
|
||||||
|
|
||||||
scaffold :todo
|
|
||||||
before_filter :login_required
|
before_filter :login_required
|
||||||
caches_action :list, :completed
|
caches_action :list, :completed
|
||||||
layout "standard"
|
layout "standard"
|
||||||
|
|
@ -16,6 +15,7 @@ class TodoController < ApplicationController
|
||||||
@places = Context.find_all
|
@places = Context.find_all
|
||||||
@projects = Project.find_all
|
@projects = Project.find_all
|
||||||
@done = Todo.find_all( "done=1", "completed DESC", 5 )
|
@done = Todo.find_all( "done=1", "completed DESC", 5 )
|
||||||
|
@count = Todo.count( "done=0" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ class TodoController < ApplicationController
|
||||||
def toggle_check
|
def toggle_check
|
||||||
item = Todo.find(@params['id'])
|
item = Todo.find(@params['id'])
|
||||||
|
|
||||||
item.toggle('done')
|
item.toggle!('done')
|
||||||
|
|
||||||
if item.save
|
if item.save
|
||||||
flash["confirmation"] = "Next action marked as completed"
|
flash["confirmation"] = "Next action marked as completed"
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,8 @@
|
||||||
<body onload="javascript:toggleAll('notes','none')">
|
<body onload="javascript:toggleAll('notes','none')">
|
||||||
<div>
|
<div>
|
||||||
<h1>
|
<h1>
|
||||||
<% if @not_done %>
|
<% if @count %>
|
||||||
<span class="badge"><%= @not_done.length %></span>
|
<span class="badge"><%= @count %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= today = Time.now; datestamp = today.strftime("%A, %e %B %Y") %></h1>
|
<%= today = Time.now; datestamp = today.strftime("%A, %e %B %Y") %></h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
</div><!-- End contexts -->
|
</div><!-- End contexts -->
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="contexts">
|
<div class="contexts">
|
||||||
<h2>Last 5 completed actions</h2>
|
<h2>Last 5 completed actions</h2>
|
||||||
<ul>
|
<ul>
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ Project wiki: <http://www.rousette.org.uk/projects/wiki/>
|
||||||
1. Uses Rails 0.9.4.1
|
1. Uses Rails 0.9.4.1
|
||||||
2. Added validation for the entry fields. If you enter a bit of text that's too long or you omit the description (not much point in a blank next action!) you'll get an error message and the action won't be saved.
|
2. Added validation for the entry fields. If you enter a bit of text that's too long or you omit the description (not much point in a blank next action!) you'll get an error message and the action won't be saved.
|
||||||
3. Added action caching.
|
3. Added action caching.
|
||||||
|
4. Did a bit of refactoring to try to make page loading a bit more efficient.
|
||||||
|
|
||||||
## Version 1.01
|
## Version 1.01
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue