public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
add asset deletion

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@1902 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Wed Aug 23 19:42:00 -0700 2006
commit  5dcfef177c1dae51a49ac5b9af6fb1c21bd50d4c
tree    79a426279138bd638bc23c1bb1c9c4a078ae240c
parent  12d022a0011d967cce713a66f456b9d1832dfb66
...
52
53
54
 
 
 
 
 
 
55
56
57
...
52
53
54
55
56
57
58
59
60
61
62
63
0
@@ -52,6 +52,12 @@ class Admin::AssetsController < Admin::BaseController
0
       redirect_to(:controller => 'articles', :action => 'new')
0
   end
0
 
0
+ def destroy
0
+ @asset.destroy
0
+ redirect_to assets_path
0
+ flash[:notice] = "Deleted '#{@asset.filename}'"
0
+ end
0
+
0
   protected
0
     def find_asset
0
       @asset = site.assets.find(params[:id])
...
3
4
5
6
7
8
9
10
11
 
12
13
14
...
21
22
23
24
25
26
27
28
29
30
31
 
32
33
34
...
3
4
5
 
 
 
 
 
 
6
7
8
9
...
16
17
18
 
 
 
 
 
 
 
 
19
20
21
22
0
@@ -3,12 +3,7 @@
0
     <tr>
0
     <% @recent.each do |asset| -%>
0
       <td>
0
- <ul class="file-tools clear">
0
- <li class="fedit"><%= link_to 'Edit', edit_asset_url(asset), :title => 'Edit this file' %></li>
0
- <li class="fdelete"><a href="#" title="Delete this file">Delete</a></li>
0
- <li class="fbucket"><a href="#" title="Put in bucket">Add to bucket</a></li>
0
- </ul>
0
- <%= link_to(asset_image_for(asset, :thumb), asset.public_filename, :target => '_blank') %>
0
+ <%= render :partial => 'asset', :object => asset if asset %>
0
       </td>
0
     <% end -%>
0
     </tr>
0
@@ -21,14 +16,7 @@
0
     <tr>
0
       <% assets_line.each do |asset| %>
0
        <td>
0
- <% if asset %>
0
- <ul class="file-tools clear">
0
- <li class="fedit"><%= link_to 'Edit', edit_asset_url(asset), :title => 'Edit this file' %></li>
0
- <li class="fdelete"><a href="#" title="Delete this file">Delete</a></li>
0
- <li class="fbucket"><a href="#" title="Put in bucket">Add to bucket</a></li>
0
- </ul>
0
- <%= link_to(asset_image_for(asset, :tiny), asset.public_filename, :target => '_blank') %>
0
- <% end %>
0
+ <%= render :partial => 'asset', :object => asset if asset %>
0
         </td>
0
        <% end %>
0
     </tr>
...
84
85
86
87
88
89
 
 
 
 
 
 
 
 
90
91
92
...
84
85
86
 
 
 
87
88
89
90
91
92
93
94
95
96
97
0
@@ -84,9 +84,14 @@ class Admin::AssetsControllerTest < Test::Unit::TestCase
0
     assert_equal [], assigns(:recent)
0
   end
0
 
0
- #def test_should_search_for_images_by_title_and_tag
0
- #
0
- #end
0
+ def test_should_delete_asset
0
+ assert_difference Asset, :count, -1 do
0
+ delete :destroy, :id => assets(:gif).id
0
+ end
0
+ # fixed in edge
0
+ #assert_redirected_to assets_path
0
+ assert_flash :notice
0
+ end
0
 
0
   def teardown
0
     FileUtils.rm_rf ASSET_PATH

Comments

    No one has commented yet.