diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index bd08a906..36fd26df 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -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 diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index fea42763..07a8cd72 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -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