Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion app/assets/javascripts/hyrax.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
//= require action_cable

//= require hyrax/monkey_patch_turbolinks
//= require hyrax/fileupload
// blueimp's standalone micro-templating helper, used by the permissions and
// relationships editors (formerly loaded via the old upload widget)
//= require fileupload/tmpl
// Provide AMD module support
//= require almond
//= require hyrax/fileupload
//= require hyrax/notification
//= require hyrax/app
//= require hyrax/config
Expand Down
20 changes: 15 additions & 5 deletions app/assets/javascripts/hyrax/fileupload.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
//= require hyrax/uploader
// This file is the default initialization of the fileupload. If you want to call
// hyraxUploader with other options (like afterSubmit), then override this file.
// This file is the default initialization of the file upload widgets. If you
// want to initialize Hyrax.Uploader with other options, override this file.
Blacklight.onLoad(function() {
var options = {};
$('#fileupload').hyraxUploader(options);
$('#fileuploadlogo').hyraxUploader({downloadTemplateId: 'logo-template-download'});
// expose the uploader for view-level initializers and overrides
window.Hyrax = window.Hyrax || {};
if (!window.Hyrax.Uploader) {
window.Hyrax.Uploader = require('hyrax/uploader').Uploader;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected require() global-require

}

var main = document.getElementById('fileupload');
if (main && !main.hyraxUploader) { new Hyrax.Uploader(main, {}); }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use 'new' for side effects no-new


var logo = document.getElementById('fileuploadlogo');
if (logo && !logo.hyraxUploader) {
new Hyrax.Uploader(logo, { rowTemplate: 'hyrax-upload-row-logo' });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use 'new' for side effects no-new

}
});
5 changes: 5 additions & 0 deletions app/assets/javascripts/hyrax/save_work/uploaded_files.es6
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export class UploadedFiles {
this.uploadsInProgress -= 1
callback(e, data)
})
// canceled or errored uploads no longer count as in progress
this.element.on('fileuploadfail', (e, data) => {
this.uploadsInProgress -= 1
callback(e, data)
})
this.element.on('fileuploaddestroyed', callback)
}

Expand Down
Loading
Loading