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)) %> - - - -
+ + +
<% 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 @@
- +

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 -%>