mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-28 18:10:15 +01:00
Added number of notes to project listing page. Fixes #128.
Interested in feedback on this... Which is higher value: the simplicity of only showing the number of actions or the utility of showing the number of notes as well? git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@485 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
8dba728577
commit
5d63400fca
3 changed files with 14 additions and 1 deletions
|
|
@ -136,6 +136,13 @@ class ProjectsController < ApplicationController
|
|||
@active_projects = @projects.select{ |p| p.active? }
|
||||
@hidden_projects = @projects.select{ |p| p.hidden? }
|
||||
@completed_projects = @projects.select{ |p| p.completed? }
|
||||
project_note_counts = Note.count(:group => 'project_id')
|
||||
@projects.each do |project|
|
||||
#define a singlton method "notes_count" on each project object
|
||||
class << project; self end.send(:define_method, :notes_count) do
|
||||
project_note_counts[project.id] || 0
|
||||
end
|
||||
end
|
||||
@new_project = @user.projects.build
|
||||
render
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue