Sha256: bb7565191237607290793039b48f8c5d400ceb05613977d6f19d2c41e5b4353c

Contents?: true

Size: 856 Bytes

Versions: 8

Compression:

Stored size: 856 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.on('fileuploadcompleted', callback)
    this.element.on('fileuploaddestroyed', callback)
  }

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

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

  get hasFiles() {
    let fileField = this.form.find('input[name="uploaded_files[]"]')
    return fileField.length > 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

8 entries across 8 versions & 1 rubygems

Version Path
hyrax-5.0.0.rc2 app/assets/javascripts/hyrax/save_work/uploaded_files.es6
hyrax-5.0.0.rc1 app/assets/javascripts/hyrax/save_work/uploaded_files.es6
hyrax-4.0.0 app/assets/javascripts/hyrax/save_work/uploaded_files.es6
hyrax-4.0.0.rc3 app/assets/javascripts/hyrax/save_work/uploaded_files.es6
hyrax-4.0.0.rc2 app/assets/javascripts/hyrax/save_work/uploaded_files.es6
hyrax-4.0.0.rc1 app/assets/javascripts/hyrax/save_work/uploaded_files.es6
hyrax-4.0.0.beta2 app/assets/javascripts/hyrax/save_work/uploaded_files.es6
hyrax-4.0.0.beta1 app/assets/javascripts/hyrax/save_work/uploaded_files.es6