vsivsi / meteor-file-collection

Extends Meteor Collections to handle file data using MongoDB gridFS.
http://atmospherejs.com/vsivsi/file-collection
Other
159 stars 37 forks source link

Preventing multiple drop zones from being activated (unAssignDrop not working) #121

Open schaazzz opened 8 years ago

schaazzz commented 8 years ago

In my application, I have 2 templates with file upload functionality using drop zones. When I upload files by dragging/dropping on one template, it triggers the file upload on both templates.

I've tried using unAssignDrop in the .onDestroyed callback but that didn't help, any ideas?

I'm assigning the drop zone in the .onRendered callback:

Files.resumable.assignDrop($("#div-attach-files-to-comment"));

And I'm un-assigning the drop zone in the .onDestroyed callback:

Files.resumable.unAssignDrop($("#div-attach-files-to-comment"));
vsivsi commented 8 years ago

Hi, file-collection only creates a single instance of resumable.js. If you want multiple independent drop zones, you need to create/configure your own resumable.js instance for each template.

See: https://github.com/vsivsi/meteor-file-collection/issues/71

schaazzz commented 8 years ago

Thank you for your answer. But for the second part of my question, shouldn't calling Files.resumable.unAssignDrop remove the specified drop zone?

vsivsi commented 8 years ago

I would assume so. If you have questions or issues about resumable.js please be aware that it is an independent project. File-collection only includes it as a convenience. I didn't write it and I don't have time to consult on its use client-side.

You can search the past issues and if necessary submit new ones on the resumable.js repo here: https://github.com/23/resumable.js

crapthings commented 8 years ago

@schaazzz we use this to clear events.

Documents.resumable.events = [];

its okay to put it into "comp did mount" or "comp will unmount ".