Sha256: 6924fb2724b5445c66bc3e505d883fdc9de193e1761a7eaaaf63ee1e75bd2326

Contents?: true

Size: 805 Bytes

Versions: 7

Compression:

Stored size: 805 Bytes

Contents

export class UploadedFiles {
  // Monitors the form and runs the callback when files are added
  constructor(form, callback) {
    this.form = form
    this.element = $('#fileupload')
    this.element.bind('fileuploadcompleted', callback)
  }

  get hasFileRequirement() {
    let fileRequirement = this.form.find('li#required-files')
    return fileRequirement.size() > 0
  }

  get inProgress() {
    return this.element.fileupload('active') > 0
  }

  get hasFiles() {
    let fileField = this.form.find('input[name="uploaded_files[]"]')
    return fileField.size() > 0
  }

  get hasNewFiles() {
    // In a future release hasFiles will include files already on the work plus new files,
    // but hasNewFiles() will include only the files added in this browser window.
    return this.hasFiles
  }
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sufia-7.4.1 app/assets/javascripts/sufia/save_work/uploaded_files.es6
sufia-7.4.0 app/assets/javascripts/sufia/save_work/uploaded_files.es6
sufia-7.3.1 app/assets/javascripts/sufia/save_work/uploaded_files.es6
sufia-7.3.0 app/assets/javascripts/sufia/save_work/uploaded_files.es6
sufia-7.3.0.rc3 app/assets/javascripts/sufia/save_work/uploaded_files.es6
sufia-7.3.0.rc2 app/assets/javascripts/sufia/save_work/uploaded_files.es6
sufia-7.3.0.rc1 app/assets/javascripts/sufia/save_work/uploaded_files.es6