filestack / filestack-rails

Official Ruby on Rails plugin for Filestack File Picker that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
223 stars 102 forks source link

None of the callbacks other than the onUploadDone CB are available through the filestack fields helpers #203

Closed zivverbit closed 5 years ago

zivverbit commented 5 years ago

None of the filepicker callbacks from the new JS SDK are available other than the onUploadDone.

the following code will raise exception about onOpen value is not in of proper type. it excepts a function, but receives a string instead. <%= f.filestack_field :storage_url, 'Pick a file', pickerOptions: { onOpen: 'myOpenCallback', fromSources: TranscriptionJob::FILE_SOURCES, storeTo: { location: 's3', path: TranscriptionJob::ORIGINALS_STORAGE_PATH }, maxFiles: UploadTranscriptionJobsOperation::MAX_FILES}, callback: '$(".pick_file_metadata").val(JSON.stringify(data.filesUploaded)); $("#language").modal("toggle");', multiple: true, class: "pick_file" %>

More over both elements should support event listening for callbacks instead of using the mandatory 'callback' argument. instead of: filestack_picker_element 'Pick a file', "myCallback", class: 'file-picker', pickerOptions: { someoptions}}

i should be able to use javascript event listening: $('.file-picker').on('onUploadDone', mycallback) $('.file-picker').on('onOpen', mycallback2)

gabifija commented 5 years ago

@zivverbit Added in 4.0.6!