Sha256: 5d4716d10d4216a8978a94b487f7a0a7f1c91915c3ea10b1a4cb31ad7dd8da20

Contents?: true

Size: 579 Bytes

Versions: 5

Compression:

Stored size: 579 Bytes

Contents

(() => {
  const application = Stimulus.Application.start()

  application.register("image-form", class extends Stimulus.Controller {
    static get targets() {
      return ["image", "imageId", "signedBlobId", "filename"]
    }

    remove(e) {
      // Prevent link
      e.preventDefault()
      e.stopPropagation()

      // Remove image and reset field
      this.imageTarget.querySelectorAll('img').forEach(image => image.remove())
      this.imageIdTarget.value = null
      this.signedBlobIdTarget.value = null
      this.filenameTarget.value = null
    }
    
  })
})()

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spina-2.0.2 app/assets/javascripts/spina/admin/controllers/image_form_controller.js
spina-2.0.1 app/assets/javascripts/spina/admin/controllers/image_form_controller.js
spina-2.0.0 app/assets/javascripts/spina/admin/controllers/image_form_controller.js
spina-2.0.0.beta app/assets/javascripts/spina/admin/controllers/image_form_controller.js
spina-2.0.0.alpha app/assets/javascripts/spina/admin/controllers/image_form_controller.js