<% if field.object_name =~ /.*\[.*\]\[(.*)\]/ %> <% assoc = true %> <% field.object.fileupload_guid = field.object.fileupload_guid + '_' + $1 %> <% else %> <% assoc = false %> <% end %> <%= content_tag(:div, :id => field.id, :class => "uploader-dnd-area") do -%> <% # if assoc || field.object.new_record? %> <%= hidden_field(field.object_name, :fileupload_guid, :object => field.object) %> <% # end %>
<%= I18n.t('uploader.button') %>
<%= fields_for field.object do |f| -%> <%= f.fields_for field.method_name, field.klass.new do |m| -%> <%= m.file_field(:data, field.input_html) %> <% end -%> <% end -%>
<%= I18n.t('uploader.or') %> <%= I18n.t('uploader.drop') %>
<%= render :partial => "uploader/#{field.theme}/upload", :locals => {:field => field} %> <%= render :partial => "uploader/#{field.theme}/download", :locals => {:field => field} %> <% end -%>