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

Get the dom element? #173

Closed jlerpscher closed 7 years ago

jlerpscher commented 7 years ago

Hi,

We are currently migrate from v2 to v3. This is one of our form input:

= f.filepicker_field :upload_url,
  services: 'COMPUTER',
  button_text: "My text",
  button_class: 'my-classes'
  onchange: 'fpUpload.display(event, this)'

In our fpUpload.display function, we can get the dom element with this variable. We are trying to do the same with v3 but the get_filestack_field_button method append only data var.

We found this work around but it's not very beautiful...

= f.filestack_field :upload_url, "My text",
  pickerOptions: { fromSources: 'local_file_system' }, 
  callback: 'fpUpload.display(filestack_input_field, data);console.log', 
  class: 'my-classes'

Do you have any other way to recover the DOM element?

jlerpscher commented 7 years ago

Our solution:

= f.filestack_field :upload_url, "My text",
  pickerOptions: { fromSources: 'local_file_system' }, 
callback: '(function (data){fpUpload.display(filestack_input_field, data);})',
  class: 'my-classes'