Sha256: 97cff3810132bdef069e353f13477d53175b3653d6a8034228e8358f9fd2f147

Contents?: true

Size: 1.97 KB

Versions: 3

Compression:

Stored size: 1.97 KB

Contents

<%= content_tag(:div, :id => field.id, :class => "uploader-dnd-area") do -%>
  <%= hidden_field(field.object_name, :fileupload_guid, :object => field.object) if field.object.new_record? %>
  
  <div class="uploader-files"></div>
  
	<div class="uploader-dnd-hints">  
	  <span class="uploader-button gray fileinput-button">
      <span><%= I18n.t('uploader.button') %></span>
      <%= 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 -%>
    </span>
    
	  <div class="uploader-dnd-hint">
		  <%= I18n.t('uploader.or') %><span><%= I18n.t('uploader.drop') %></span>
	  </div>
	</div>
	
	<%= render :partial => "uploader/#{field.theme}/upload", :locals => {:field => field} %>
  <%= render :partial => "uploader/#{field.theme}/download", :locals => {:field => field} %>
  <%= render :partial => "uploader/#{field.theme}/sortable", :locals => {:field => field} if field.sortable? %>
  
	<script type="text/javascript">
    $(function() {
      var uploader, container;
      container = $("#<%= field.id %> div.uploader-files");
      
      $('#<%= field.id %> input[type="file"]').each(function(){
        $(this).fileupload({
          dataType: 'json',
          dropZone: $("#<%= field.id %>"),
          autoUpload: true,
          paramName: "asset[data]",
          formData: function(form){ return []; },
          filesContainer: container,
          namespace: 'uploader',
          uploadTemplateId: 'template-upload-<%= field.klass %>',
          downloadTemplateId: 'template-download-<%= field.klass %>'
        });
        
        <% if field.exists? -%>
          uploader = ($(this).data('blueimp-fileupload') || $(this).data('fileupload'));
          uploader
            ._renderDownload(<%=raw field.values.sort_by {|s| s.sort }.map(&:to_jq_upload).to_json %>)
            .appendTo(container);
        <% end -%>
      });
    });
  </script>
<% end -%>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
glebtv-rails-uploader-0.6.0 app/views/uploader/default/_container.html.erb
glebtv-rails-uploader-0.5.1 app/views/uploader/default/_container.html.erb
glebtv-rails-uploader-0.5.0 app/views/uploader/default/_container.html.erb