Browse files

Basic uploading support (in progress)

  • Loading branch information...
1 parent f03148d commit ad2f6085a181386a033b7394fea6f06ce885b69a @jbbarth jbbarth committed Jan 30, 2009
Showing with 13 additions and 3 deletions.
  1. +7 −0 app/controllers/admin/assets_controller.rb
  2. +4 −2 app/views/admin/assets/index.html.erb
  3. +2 −1 config/routes.rb
View
7 app/controllers/admin/assets_controller.rb
@@ -17,4 +17,11 @@ def create
render :action => :new
end
end
+
+ def destroy
+ @asset = Asset.find(params[:id])
+ @asset.destroy
+ flash[:notice] = 'Asset was successfully destroyed.'
+ redirect_to Site.full_url + '/admin/assets'
+ end
end
View
6 app/views/admin/assets/index.html.erb
@@ -8,15 +8,17 @@
<table class="list" cellspacing="0" cellpadding="0">
<tr>
- <th class="first_col">Filename</th>
+ <th class="first_col">Thumb</th>
+ <th>Filename</th>
<th>Uploaded at</th>
<th class="del_col">X</th>
</tr>
<% f = 1 -%>
<% for asset in @assets -%>
<tr class="<%= cycle('alt_row ','') %><%= (f == 1 ? 'first_row' : '') %>">
- <td class="first_col"><%= link_to asset.filename, Site.full_url + '/admin/assets/edit/' + asset.id.to_s %></td>
+ <td class="first_col"><%= link_to image_tag(asset.public_filename(:thumb)), asset.public_filename %></td>
+ <td><%= link_to asset.filename, asset.public_filename %></td>
<td><%= asset.created_at %></td>
<td class="del_col"><%= link_to 'X', Site.full_url + '/admin/assets/destroy/' + asset.id.to_s, :confirm => "You are about to delete this asset. This is permanent.\n\nAre you ABSOLUTELY sure?" %></td>
</tr>
View
3 config/routes.rb
@@ -23,8 +23,9 @@
# assets
# map.resources :assets
- map.connect 'admin/assets', :controller => 'admin/assets', :action => 'index'
+ map.connect 'admin/assets/:action/:id', :controller => 'admin/assets'
map.connect 'admin/assets/:action', :controller => 'admin/assets'
+ map.connect 'admin/assets', :controller => 'admin/assets', :action => 'index'
tokens = /archives|older|past/

0 comments on commit ad2f608

Please sign in to comment.