Sha256: 1edd9fb8ec8586ea5feec81abb231f980db3422a5593dfba1200f70568bdd03d

Contents?: true

Size: 616 Bytes

Versions: 65

Compression:

Stored size: 616 Bytes

Contents

import FileFieldController from "koi/controllers/file_field_controller";

export default class DocumentFieldController extends FileFieldController {
  connect() {
    this.initialPreviewContent = this.filenameTag.text;
  }

  setPreviewContent(content) {
    this.filenameTag.innerText = content;
  }

  showPreview(file) {
    const reader = new FileReader();

    reader.onload = (e) => {
      if (this.filenameTag) {
        this.filenameTag.innerText = file.name;
      }
    };
    reader.readAsDataURL(file);
  }

  get filenameTag() {
    return this.previewTarget.querySelector("p.preview-filename");
  }
}

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
katalyst-koi-4.1.0 app/assets/javascripts/koi/controllers/document_field_controller.js
katalyst-koi-4.0.3 app/assets/javascripts/koi/controllers/document_field_controller.js
katalyst-koi-4.0.2 app/assets/javascripts/koi/controllers/document_field_controller.js
katalyst-koi-4.0.1 app/assets/javascripts/koi/controllers/document_field_controller.js
katalyst-koi-4.0.0 app/assets/javascripts/koi/controllers/document_field_controller.js