diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb
index 9e8a5597..329b38e5 100644
--- a/app/controllers/notes_controller.rb
+++ b/app/controllers/notes_controller.rb
@@ -27,13 +27,29 @@ class NotesController < ApplicationController
def create
note = current_user.notes.build
- note.attributes = params["new_note"]
-
- if note.save
- render :partial => 'notes_summary', :object => note
- else
- render :text => ''
- end
+ note.attributes = params["note"]
+
+ saved = note.save
+
+ respond_to do |format|
+ format.js do
+ if note.save
+ render :partial => 'notes_summary', :object => note
+ else
+ render :text => ''
+ end
+ end
+ format.xml do
+ if saved
+ head :created, :location => note_url(note), :text => "new note with id #{note.id}"
+ else
+ render_failure note.errors.full_messages.join(', ')
+ end
+ end
+ format.html do
+ render :text => 'unexpected request for html rendering'
+ end
+ end
end
def destroy
diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb
index efa84ab9..f969bd87 100644
--- a/app/views/projects/show.html.erb
+++ b/app/views/projects/show.html.erb
@@ -28,8 +28,8 @@
:position => "bottom",
:complete => "$('#notes').effect('highlight', 1000);$('#empty-n').hide();$('#new-note form').clearForm();",
:html => {:id=>'form-new-note', :class => 'inline-form'} do %>
- <%= hidden_field( "new_note", "project_id", "value" => "#{@project.id}" ) %>
- <%= text_area( "new_note", "body", "cols" => 50, "rows" => 3, "tabindex" => 1 ) %>
+ <%= hidden_field( "note", "project_id", "value" => "#{@project.id}" ) %>
+ <%= text_area( "note", "body", "cols" => 50, "rows" => 3, "tabindex" => 1 ) %>
<% end -%>