applied the patch from Peter Suschlik in #641. Changed the badge count for completed actions to the number of actions shown in stead of the total number of completed actions. Thanks Peter for the patch

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@705 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lrbalt 2008-02-13 08:49:08 +00:00
parent 67c79ba5a6
commit da63b552ce
2 changed files with 52 additions and 49 deletions

View file

@ -1,49 +1,50 @@
class NotesController < ApplicationController class NotesController < ApplicationController
def index def index
@all_notes = current_user.notes @all_notes = current_user.notes
@page_title = "TRACKS::All notes" @count = @all_notes.size
respond_to do |format| @page_title = "TRACKS::All notes"
format.html respond_to do |format|
format.xml { render :xml => @all_notes.to_xml( :except => :user_id ) } format.html
end format.xml { render :xml => @all_notes.to_xml( :except => :user_id ) }
end end
end
def show
@note = current_user.notes.find(params['id']) def show
@page_title = "TRACKS::Note " + @note.id.to_s @note = current_user.notes.find(params['id'])
end @page_title = "TRACKS::Note " + @note.id.to_s
end
def create
note = current_user.notes.build def create
note.attributes = params["new_note"] note = current_user.notes.build
note.attributes = params["new_note"]
if note.save
render :partial => 'notes_summary', :object => note if note.save
else render :partial => 'notes_summary', :object => note
render :text => '' else
end render :text => ''
end end
end
def destroy
note = current_user.notes.find(params['id']) def destroy
if note.destroy note = current_user.notes.find(params['id'])
render :text => '' if note.destroy
else render :text => ''
notify :warning, "Couldn't delete note \"#{note.id}\"" else
render :text => '' notify :warning, "Couldn't delete note \"#{note.id}\""
end render :text => ''
end end
end
def update
note = current_user.notes.find(params['id']) def update
note.attributes = params["note"] note = current_user.notes.find(params['id'])
if note.save note.attributes = params["note"]
render :partial => 'notes', :object => note if note.save
else render :partial => 'notes', :object => note
notify :warning, "Couldn't update note \"#{note.id}\"" else
render :text => '' notify :warning, "Couldn't update note \"#{note.id}\""
end render :text => ''
end end
end
end
end

View file

@ -244,11 +244,13 @@ class TodosController < ApplicationController
@done_today = @done.completed_within current_user.time - 1.day @done_today = @done.completed_within current_user.time - 1.day
@done_this_week = @done.completed_within current_user.time - 1.week @done_this_week = @done.completed_within current_user.time - 1.week
@done_this_month = @done.completed_within current_user.time - 4.week @done_this_month = @done.completed_within current_user.time - 4.week
@count = @done_today.size + @done_this_week.size + @done_this_month.size
end end
def completed_archive def completed_archive
@page_title = "TRACKS::Archived completed tasks" @page_title = "TRACKS::Archived completed tasks"
@done = current_user.completed_todos @done = current_user.completed_todos
@count = @done.size
@done_archive = @done.completed_more_than current_user.time - 28.days @done_archive = @done.completed_more_than current_user.time - 28.days
end end