diff --git a/tracks/app/controllers/notes_controller.rb b/tracks/app/controllers/notes_controller.rb
index c3c8fbec..5b360626 100644
--- a/tracks/app/controllers/notes_controller.rb
+++ b/tracks/app/controllers/notes_controller.rb
@@ -27,13 +27,24 @@ class NotesController < ApplicationController
end
def destroy
- note = current_user.notes.find(params['id'])
- if note.destroy
- render :text => ''
- else
- notify :warning, "Couldn't delete note \"#{note.id}\""
- render :text => ''
+ @note = current_user.notes.find(params['id'])
+
+ @note.destroy
+
+ respond_to do |format|
+ format.html
+ format.js do
+ @count = current_user.notes.size
+ render
+ end
end
+
+ # if note.destroy
+ # render :text => ''
+ # else
+ # notify :warning, "Couldn't delete note \"#{note.id}\""
+ # render :text => ''
+ # end
end
def update
diff --git a/tracks/app/views/notes/_notes.rhtml b/tracks/app/views/notes/_notes.rhtml
index 3a329481..2d4c3a1a 100644
--- a/tracks/app/views/notes/_notes.rhtml
+++ b/tracks/app/views/notes/_notes.rhtml
@@ -1,35 +1,39 @@
<% note = notes -%>
-
<%= link_to("Note #{note.id}", note_path(note), :title => "Show note #{note.id}" ) %>
+
<%= link_to("Note #{note.id}", note_path(note), :title => "Show note #{note.id}" ) %>
- <%= sanitize(textilize(note.body)) %>
-
-
-
-
- <% form_remote_tag :url => note_path(note),
- :method => :put,
- :html => { :id => dom_id(note, 'edit_form'), :class => "inline-form" },
- :update => dom_id(note, 'container'),
- :complete => visual_effect(:appear, dom_id(note, 'container')) do -%>
- <%= render :partial => "note_edit_form", :object => note %>
+ <%= link_to("In: " + note.project.name, project_path(note.project), :class=>"footer_link" ) %> |
+ Created: <%= format_date(note.created_at) %>
+ <% if note.updated_at? -%>
+ | Modified: <%= format_date(note.updated_at) %>
<% end -%>
+
+
+ <% form_remote_tag :url => note_path(note),
+ :method => :put,
+ :html => { :id => dom_id(note, 'edit_form'), :class => "inline-form" },
+ :update => dom_id(note, 'container'),
+ :complete => visual_effect(:appear, dom_id(note, 'container')) do -%>
+ <%= render :partial => "note_edit_form", :object => note %>
+ <% end -%>
+
+
<% note = nil -%>
diff --git a/tracks/app/views/notes/destroy.rjs b/tracks/app/views/notes/destroy.rjs
new file mode 100644
index 00000000..3557e02e
--- /dev/null
+++ b/tracks/app/views/notes/destroy.rjs
@@ -0,0 +1,3 @@
+page.notify :notice, "Deleted note '#{@note.id}'", 5.0
+page['badge_count'].replace_html @count
+page.hide "busy"
diff --git a/tracks/app/views/projects/show.rhtml b/tracks/app/views/projects/show.rhtml
index e23dc109..a5fbdc5e 100644
--- a/tracks/app/views/projects/show.rhtml
+++ b/tracks/app/views/projects/show.rhtml
@@ -11,7 +11,7 @@
-
<%= link_to_function( "Add a note", "Element.toggle('new-note'); Form.focusFirstElement('form-new-note');") %>
+
<%= link_to_function( "Add a note", "Element.toggle('new-note'); Form.focusFirstElement('form-new-note');", :id=>"add_note_href") %>
Notes
<%= render :partial => "shared/empty",
@@ -32,7 +32,7 @@
<%= hidden_field( "new_note", "project_id", "value" => "#{@project.id}" ) %>
<%= text_area( "new_note", "body", "cols" => 50, "rows" => 3, "tabindex" => 1 ) %>
-
+
<% end -%>