Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Basic uploading support (in progress)

  • Loading branch information...
commit ad2f6085a181386a033b7394fea6f06ce885b69a 1 parent f03148d
Jean-Baptiste Barth jbbarth authored
7 app/controllers/admin/assets_controller.rb
View
@@ -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
6 app/views/admin/assets/index.html.erb
View
@@ -8,7 +8,8 @@
<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>
@@ -16,7 +17,8 @@
<% 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>
3  config/routes.rb
View
@@ -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/
Please sign in to comment.
Something went wrong with that request. Please try again.