-
<%= link_to_function( "Add a note", "Element.toggle('new-note'); Form.focusFirstElement('form-new-note');", :id=>"add_note_href") %>
+
<%= link_to 'Add a note', '#' %>
Notes
<%= render :partial => "shared/empty",
@@ -26,7 +26,7 @@
:method => :post,
:update => "notes",
:position => "bottom",
- :complete => "new Effect.Highlight('notes');$('empty-n').hide();Form.reset('form-new-note');",
+ :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 ) %>
@@ -39,4 +39,4 @@
<%= render :partial => "shared/add_new_item_form" %>
<%= render :file => "sidebar/sidebar.html.erb" %>
-
\ No newline at end of file
+
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index bf2cbb64..d9b91aa4 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -427,6 +427,12 @@ $(document).ready(function() {
$(this).parents('.edit-form').find('form').clearForm();
});
+ $(".add_note_link a").live('click', function(){
+ $('#new-note').show();
+ $('#new-note form').clearForm();
+ $('#new-note form input:first').focus();
+ });
+
$("#list-active-projects").sortable({handle: '.handle', update: update_order});
$("#list-hidden-projects").sortable({handle: '.handle', update: update_order});
$("#list-completed-projects").sortable({handle: '.handle', update: update_order});
diff --git a/test/selenium/project_detail/add_note.rsel b/test/selenium/project_detail/add_note.rsel
new file mode 100644
index 00000000..a4a39905
--- /dev/null
+++ b/test/selenium/project_detail/add_note.rsel
@@ -0,0 +1,14 @@
+setup :fixtures => :all
+login :as => 'admin'
+
+#first, defer a todo
+open "/projects/1"
+
+click "css=.add_note_link a"
+
+assert_visible "new-note"
+
+type "new_note_body", "this is a note"
+click 'css=#new-note input[type=submit]'
+
+wait_for_text_present "this is a note"