Browse files

Remove Asset DIV from index after destroy via RJS partial

  • Loading branch information...
1 parent 1487a84 commit d1d7d128206c40bff3aa61628fa16de3732c0def @aviflombaum aviflombaum committed Apr 12, 2012
Showing with 7 additions and 2 deletions.
  1. +1 −1 app/controllers/assets_controller.rb
  2. +5 −0 app/views/assets/_destroy.rjs
  3. +1 −1 app/views/assets/index.haml
View
2 app/controllers/assets_controller.rb
@@ -79,7 +79,7 @@ def destroy
flash[:warning] = "<strong>#{titles}</strong> has been deleted from the database."
lastsearch
end
- format.js
+ format.js { render :partial => 'assets/destroy' }
end
end
View
5 app/views/assets/_destroy.rjs
@@ -0,0 +1,5 @@
+if @destroyed_id
+ page.visual_effect :fade, "asset_#{@destroyed_id}", :duration => 0.5
+else
+ page.call 'alert', "That entry is still in use and can not be destroyed."
+end
View
2 app/views/assets/index.haml
@@ -3,7 +3,7 @@
- unless @assets.empty?
= render :partial => "pagination"
- @assets.each do |asset|
- %div.recordItem
+ %div.recordItem{:id => "asset_#{asset.id}"}
%div.recordItemTitle
%h2

0 comments on commit d1d7d12

Please sign in to comment.