Added a flash warning to todo/list and project/show/[name] pages when contexts are empty to remind users that you need to add a context before adding any next actions.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@194 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2006-02-26 12:02:11 +00:00
parent 6dd0f51dbd
commit 6b09ffa0a8
2 changed files with 10 additions and 1 deletions

View file

@ -30,6 +30,10 @@ class ProjectController < ApplicationController
@on_page = "project"
@page_title = "TRACKS::Project: #{@project.name}"
if @contexts.empty?
flash['warning'] = 'You must add at least one context before adding next actions.'
end
if @not_done.empty?
@msg_nd = "Currently there are no uncompleted actions in this project"
else

View file

@ -27,6 +27,10 @@ class TodoController < ApplicationController
@contexts_to_show = @contexts.clone
@contexts_to_show = @contexts_to_show.collect {|x| (!x.hide? and !x.find_not_done_todos.empty?) ? x:nil }.compact
if @contexts.empty?
flash['warning'] = 'You must add at least one context before adding next actions.'
end
# Set count badge to number of not-done, not hidden context items
@count = @todos.collect { |x| ( !x.done? and !x.context.hide? ) ? x:nil }.compact.size
@ -48,8 +52,9 @@ class TodoController < ApplicationController
else
@item.due = ""
end
@saved = @item.save
@on_page = "home"
if @saved
@up_count = @todos.collect { |x| ( !x.done? and !x.context.hide? ) ? x:nil }.compact.size.to_s