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 101 forks source link

Filestack Form Helper with no options renders javascript syntax error #200

Closed diegous closed 5 years ago

diegous commented 5 years ago

A form helper like this one

<%= f.filestack_field :image_url, 'Upload Photo' %>

renders this html/js code


<button name="button" type="button" onclick="(function(){
          filestack_client.picker({, onUploadDone: data => (function(data){const filestack_input_field= document.getElementById('nilclass_image_url');filestack_input_field.value = data.filesUploaded[0].url;})(data)}).open()
        })()">
  Upload Photo
</button>
<input id="nilclass_image_url" style="display:none" type="text" name="selfies[image_url]">

The issue is on the object received by the filestack_client.picker function that has a comma preceded by nothing and followed by the onUploadDone callback:

{ , onUploadDone: data => (function(data){...}) }
gabifija commented 5 years ago

@diegous Already fixed! 🙏