orbit-basic/app/views/admin/designs/_design_file.html.erb

35 lines
1.2 KiB
Plaintext
Raw Normal View History

2011-07-20 09:05:28 +00:00
<% item_destroy ||= false %>
<% item_snapshot ||= false %>
2011-07-26 10:22:17 +00:00
<% item_editable ||= false %>
2011-07-20 09:05:28 +00:00
<% li_class = ''%>
2011-07-20 06:04:16 +00:00
<% fieldname_p = fieldname.pluralize %>
<%= f.label "fieldname", t('admin.'+fieldname) %>
<ul>
<% object.send(fieldname_p).each do |t| %>
2011-07-20 09:05:28 +00:00
<% li_class += 'r_destroy ' if item_destroy %>
<% li_class += 'r_snapshot ' if item_snapshot %>
2011-07-26 10:22:17 +00:00
<% li_class += 'r_edit ' if item_editable %>
<li class="<%= li_class %>" <%= "path='#{t.file.url}' filename='#{t.file_filename}'" if (item_snapshot || item_editable) %> >
2011-07-26 10:22:17 +00:00
<%= 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 %>
2011-07-20 06:04:16 +00:00
</li>
<% end %>
</ul>
2011-07-26 10:22:17 +00:00
<p class="new_file">
2011-07-20 09:05:28 +00:00
<%= fields_for "design["+fieldname_p+"][]", object, :index => nil do |f| %>
2011-07-26 10:22:17 +00:00
<%= f.hidden_field :id,{:value=>''} %>
2011-07-20 06:04:16 +00:00
<%= f.file_field :file ,{:class=>"multi_files",:rtype=>rtype}%>
2011-07-26 10:22:17 +00:00
</p>
2011-07-20 06:04:16 +00:00
<% end %>