Sha256: cbf74f84ba97118e7348f7a34ed0e395d4ab97bc3417e6239dfcab7fb853625e

Contents?: true

Size: 729 Bytes

Versions: 36

Compression:

Stored size: 729 Bytes

Contents

import ApplicationController from "satis/controllers/application_controller"

export default class FileController extends ApplicationController {
  static targets = ["selection", "input"]

  connect() {
    this.boundUpdate = this.update.bind(this)
    this.inputTarget.addEventListener("change", this.boundUpdate)
    this.update()
  }

  disconnect() {
    this.inputTarget.removeEventListener("change", this.boundUpdate)
  }

  update(evt) {
    this.selectionTarget.innerHTML = ""
    Array.from(this.inputTarget.files).forEach((file) => {
      this.selectionTarget.innerHTML += `${file.name}<br>`
    })
  }

  toggle(value) {
    // FIXME: We should capture the current content and update the template it came from.
  }
}

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
satis-2.1.43 app/javascript/satis/controllers/file_controller.js
satis-2.1.42 app/javascript/satis/controllers/file_controller.js
satis-2.1.41 app/javascript/satis/controllers/file_controller.js
satis-2.1.40 app/javascript/satis/controllers/file_controller.js
satis-2.1.39 app/javascript/satis/controllers/file_controller.js
satis-2.1.38 app/javascript/satis/controllers/file_controller.js
satis-2.1.37 app/javascript/satis/controllers/file_controller.js
satis-2.1.36 app/javascript/satis/controllers/file_controller.js
satis-2.1.35 app/javascript/satis/controllers/file_controller.js
satis-2.1.33 app/javascript/satis/controllers/file_controller.js
satis-2.1.31 app/javascript/satis/controllers/file_controller.js
satis-2.1.30 app/javascript/satis/controllers/file_controller.js
satis-2.1.29 app/javascript/satis/controllers/file_controller.js
satis-2.1.28 app/javascript/satis/controllers/file_controller.js
satis-2.1.27 app/javascript/satis/controllers/file_controller.js
satis-2.1.26 app/javascript/satis/controllers/file_controller.js
satis-2.1.24 app/javascript/satis/controllers/file_controller.js
satis-2.1.23 app/javascript/satis/controllers/file_controller.js
satis-2.1.22 app/javascript/satis/controllers/file_controller.js
satis-2.1.21 app/javascript/satis/controllers/file_controller.js