Spree.Views.Attachments.UploadZone = Backbone.View.extend( events: 'dragover': 'onDragOver' 'dragleave': 'onDragLeave' 'drop': 'onDrop' 'change input[type="file"]': 'onFileBrowserSelect' upload: (file) -> progressModel = new (Spree.Models.AttachmentUpload)(file: file) @collection.add progressModel progressModel.previewFile() progressModel.uploadFile() return dragClass: 'with-attachments' onDragOver: (e) -> @el.classList.add @dragClass e.preventDefault() return onDragLeave: -> @el.classList.remove @dragClass return onDrop: (e) -> @el.classList.remove @dragClass e.preventDefault() _.each e.originalEvent.dataTransfer.files, @upload, this return onFileBrowserSelect: (e) -> _.each e.target.files, @upload, this return )