<% item_destroy ||= false %>
<% item_snapshot ||= false %>
<% item_editable ||= false %>
<% li_class = ''%>

<% fieldname_p = fieldname.pluralize  %>
<%= f.label "fieldname", t('admin.'+fieldname) %>
<ul>
  <% object.send(fieldname_p).each do |t| %>
    <% li_class += 'r_destroy ' if item_destroy  %>
    <% li_class += 'r_snapshot ' if item_snapshot %>
    <% li_class += 'r_edit ' if item_editable %>
    <li class="<%= li_class %>" <%= "path='#{t.file.url}' filename='#{t.file_filename}'" if (item_snapshot || item_editable)  %>  > 
      <%= t.file_filename %>
      <% if item_destroy  %>
        <%=fields_for "design["+fieldname_p+"][]",t,:index=>nil do |f| %>
          <%= f.hidden_field :id %>
          <%= f.hidden_field :to_destroy %>
        <%end%>
        <a class="remove_mark" href="#"><%= t('Delete') %></a>
      <%end%>
      
      <% if item_editable %>
        <a class="edit_mark" href="#"><%= t('Edit') %></a>
      <% end %>
    </li>
  <% end %>
</ul>
<p class="new_file">
<%= fields_for "design["+fieldname_p+"][]", object, :index => nil do |f| %>
  <%= f.hidden_field :id,{:value=>''} %>
  <%= f.file_field :file ,{:class=>"multi_files",:rtype=>rtype}%>
</p>
<% end %>