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.20 app/javascript/satis/controllers/file_controller.js
satis-2.1.19 app/javascript/satis/controllers/file_controller.js
satis-2.1.18 app/javascript/satis/controllers/file_controller.js
satis-2.1.11 app/javascript/satis/controllers/file_controller.js
satis-2.1.10 app/javascript/satis/controllers/file_controller.js
satis-2.1.9 app/javascript/satis/controllers/file_controller.js
satis-2.1.8 app/javascript/satis/controllers/file_controller.js
satis-2.1.6 app/javascript/satis/controllers/file_controller.js
satis-2.1.5 app/javascript/satis/controllers/file_controller.js
satis-2.1.4 app/javascript/satis/controllers/file_controller.js
satis-2.1.3 app/javascript/satis/controllers/file_controller.js
satis-2.1.1 app/javascript/satis/controllers/file_controller.js
satis-2.1.0 app/javascript/satis/controllers/file_controller.js
satis-2.0.9 app/javascript/satis/controllers/file_controller.js
satis-2.0.8 app/javascript/satis/controllers/file_controller.js
satis-2.0.7 app/javascript/satis/controllers/file_controller.js