* Replaced select widgets with AutoCompleters for project & context in new item and edit forms. You can now create a new project and/or context on the fly as you're adding an item.

* Rolled Deferred controller, views & helper into Todo.
* Made the show_from field always available on the add new item and edit forms.
* Added validation to Todo to make sure a context is specified.
* Set initial state of Todo to :deferred when show_from is specified (I still need to make handle setting show_from during an edit).
* Created a generic rescue_action in ApplicationController and removed boilerplate rescue code from a few actions in TodoController.
* Made all Todo creation requests use the TodoController, removing duplicate logic from ContextController and ContextController
* Removed unused lightbox-style add item form
* Remove unused update_context and update_project actions
* Updated rails javascripts to the same as our vendor/rails



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@352 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-11-20 04:31:00 +00:00
parent 5d51ca84ba
commit bb1cfe613a
36 changed files with 627 additions and 720 deletions

View file

@ -61,46 +61,6 @@ class ContextController < ApplicationController
end
end
# Called by a form button
# Parameters from form fields are passed to create new action
# in the selected context.
def add_item
self.init
@item = @user.todos.build
@item.attributes = params["todo"]
if @item.due?
@date = parse_date_per_user_prefs(params["todo"]["due"])
@item.due = @date.to_s(:db)
else
@item.due = ""
end
@saved = @item.save
if @saved
@up_count = Todo.find(:all, :conditions => ["todos.user_id = ? and todos.state = ? and todos.context_id = ?", @user.id, 'active', @item.context_id]).size.to_s
end
return if request.xhr?
# fallback for standard requests
if @saved
notify :notice, 'Added new next action.'
redirect_to :controller => 'todo', :action => 'list'
else
notify :warning, 'The next action was not added. Please try again.'
redirect_to :controller => 'todo', :action => 'list'
end
rescue
if request.xhr? # be sure to include an error.rjs
render :action => 'error'
else
notify :warning, 'An error occurred on the server.'
redirect_to :controller => 'todo', :action => 'list'
end
end
# Edit the details of the context
#
def update