<div class="contextual">
<%= link_to(l(:label_attachment_new), new_cms_asset_path, :class => 'icon icon-add') %>
</div>

<h2><%=l(:label_cms_asset_plural)%></h2>
<%= form_tag(cms_assets_path, :multipart => true, :class => "tabular") do %>
<div class="box">
<table class="list files">
  <thead><tr>
    <th><%= l(:label_cms_thumbnail) %></th>
    <%= sort_header_tag('filename', :caption => l(:field_filename)) %>
    <%= sort_header_tag('description', :caption => l(:field_description)) %>
    <%= sort_header_tag('created_on', :caption => l(:label_date), :default_order => 'desc') %>
    <%= sort_header_tag('size', :caption => l(:field_filesize), :default_order => 'desc') %>
    <th></th>
  </tr></thead>
  <tbody>

  <% @attachments.each do |file| %>
  <tr class="file <%= cycle("odd", "even") %>">
    <td class="thumbnail"><%= file.thumbnailable? ? cms_thumbnail_tag(file) : link_to('', download_named_asset_path(file, file.filename),:class => 'icon icon-file') %></td>
    <td class="filename"><%= link_to file.filename, named_asset_path(file, file.filename), :title => file.description %></td>
    <td class="name description"><%= file.description %></td>
    <td class="created_on"><%= format_time(file.created_on) %></td>
    <td class="filesize"><%= number_to_human_size(file.filesize) %></td>
    <td class="buttons">
    <%= link_to(l(:label_edit_attachments),
                cms_assets_edit_path(:id => file.id),
                :title => l(:label_edit_attachments),
                :class => 'icon-only icon-edit'
               )  %>
    <%= link_to(image_tag('delete.png'), cms_asset_path(file),
                                         :data => {:confirm => l(:text_are_you_sure)}, :method => :delete) if User.current.admin? %>
    </td>
  </tr>
  <% end %>
  </tbody>
</table>



<p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
</div>
<%= submit_tag l(:button_add) %>
<% end %>

<% content_for :sidebar do %>
  <% render :partial => 'cms_settings/menu' %>
<% end %>


<% html_title(l(:label_cms_asset_plural)) -%>
