David Kimura PRO
Joined 7/18/2015
Drifting Ruby Owner
David Kimura PRO said over 5 years ago on StimulusJS, Active Storage and DropzoneJS :
dropzone.on("addedfile", file => {
      setTimeout(() => {
        if (file.accepted) {
          const upload = new DirectUpload(file, this.url)
          upload.create((error, blob) => {
            ########## INSERT HERE #########
            console.log(blob)
            ########## INSERT HERE #########
            this.hiddenInput = document.createElement("input")
            this.hiddenInput.type = "hidden"
            this.hiddenInput.name = this.inputTarget.name
            this.hiddenInput.value = blob.signed_id
            this.inputTarget.parentNode.insertBefore(this.hiddenInput, this.inputTarget.nextSibling)
            dropzone.emit("success", file)
            dropzone.emit("complete", file)
          })
        }
      }, 500)
    })
  }

David Kimura PRO said over 5 years ago on StimulusJS, Active Storage and DropzoneJS :
Sorry   for not being more clear, it is the Developer Tools Console within your browser.


David Kimura PRO said over 5 years ago on Autocomplete with StimulusJS :
  can you post relevant code? Also, check your browser's console for any errors as that could prevent controllers from firing. In the initialize() function, you could put a console.log within there to make sure that it is getting triggered. If it isn't, there could be a naming issue or something else. Also, when you register the autocomplete library (likely in the index.js in the controllers folder), make sure you're using that name as the data-controller.


David Kimura PRO said over 5 years ago on Autocomplete with StimulusJS :
  The stimulus controller doesn't actually get "installed".  In the javascript/controllers/index.js you should import the library and then register it with the Stimulus library.

import { Autocomplete } from 'stimulus-autocomplete'

application.register('autocomplete', Autocomplete) 

David Kimura PRO said over 5 years ago on StimulusJS, Active Storage and DropzoneJS :
Awesome   ! and thank you for posting your solution here for others to find!