summaryrefslogtreecommitdiff
path: root/www/js/importer.js
diff options
context:
space:
mode:
authorPeter Grassberger <petertheone@gmail.com>2016-02-02 16:09:02 (GMT)
committerPeter Grassberger <petertheone@gmail.com>2016-02-02 16:09:02 (GMT)
commit070becf035f7c1b492cca1213b026563098d7f53 (patch)
tree0e002fd6f5694b20e73a235ff0ac54c550908895 /www/js/importer.js
parentada31015e989d062ac68d58c94701e2df253b21e (diff)
musicpools: add progressbar
Diffstat (limited to 'www/js/importer.js')
-rw-r--r--www/js/importer.js35
1 files changed, 6 insertions, 29 deletions
diff --git a/www/js/importer.js b/www/js/importer.js
index 25924fb..e06e46c 100644
--- a/www/js/importer.js
+++ b/www/js/importer.js
@@ -34,7 +34,7 @@ Rivendell.Importer.prototype.resetModal = function() {
$('#uploadModal-confirm', this.$el).attr('disabled','disabled').off('click');
};
-Rivendell.Importer.prototype.openModal = function(group, createCart, useMetadata) {
+Rivendell.Importer.prototype.openModal = function(group, groupView, createCart, useMetadata) {
this.resetModal();
if (createCart === undefined) {
@@ -59,7 +59,7 @@ Rivendell.Importer.prototype.openModal = function(group, createCart, useMetadata
autoProcessQueue: false,
init: function() {
this.on('addedfile', function(file) {
- self.importFileAdded(this, file, group, createCart, useMetadata);
+ self.importFileAdded(this, file, group, groupView, createCart, useMetadata);
});
this.on('error', function(file, msg) {
self.importFileSelectError(this, file, msg);
@@ -71,7 +71,7 @@ Rivendell.Importer.prototype.openModal = function(group, createCart, useMetadata
this.$el.modal({keyboard: true});
};
-Rivendell.Importer.prototype.importFileAdded = function(dropzone, file, group, createCart, useMetadata) {
+Rivendell.Importer.prototype.importFileAdded = function(dropzone, file, group, groupView, createCart, useMetadata) {
// wtf? remove accepted files?
/*$(dropzone.getAcceptedFiles()).each(function(index, elem) {
dropzone.removeFile(elem);
@@ -82,7 +82,7 @@ Rivendell.Importer.prototype.importFileAdded = function(dropzone, file, group, c
var self = this;
$('#uploadModal-confirm', this.$el).off('click').on('click', function() {
- self.importCartConfirm(dropzone, group, createCart, useMetadata);
+ self.importCartConfirm(dropzone, group, groupView, createCart, useMetadata);
}).removeAttr('disabled');
};
@@ -91,7 +91,7 @@ Rivendell.Importer.prototype.importFileSelectError = function(dropzone, file, ms
dropzone.removeFile(file);
};
-Rivendell.Importer.prototype.importCartConfirm = function(dropzone, group, createCart, useMetadata) {
+Rivendell.Importer.prototype.importCartConfirm = function(dropzone, group, groupView, createCart, useMetadata) {
this.$el.modal('hide');
//var progressBar = group.addUpload();
@@ -109,7 +109,7 @@ Rivendell.Importer.prototype.importCartConfirm = function(dropzone, group, creat
//jingles_importUpdateProgress(files[0], importing_row);
var self = this;
dropzone.on('uploadprogress', function(file) {
- self.uploadProgress(file);
+ groupView.uploadProgress(file);
});
dropzone.on('success', function(file) {
self.importFileUploadSuccess(dropzone, file, group);
@@ -132,29 +132,6 @@ Rivendell.Importer.prototype.importCartConfirm = function(dropzone, group, creat
}
};
-Rivendell.Importer.prototype.uploadProgress = function(file) {
- if (!file.cartNumber || !file.cutNumber) {
- return;
- }
- var $cut = $('#jingle-' + file.cartNumber + '-' + file.cutNumber).first();
- if (!$cut.hasClass('uploading')) {
- var $progressBar = $('.progressBarTemplate').clone().removeClass('progressBarTemplate');
- $cut.html($progressBar.html());
- $cut.addClass('uploading');
- }
-
- if(file.upload.progress < 99) {
- var bytes_str = Number((file.upload.bytesSent/1024)/1024).toFixed(1) + " von " +
- Number((file.upload.total/1024)/1024).toFixed(1) + " MB";
- $cut.find('.file-bytes').text(bytes_str);
- $cut.find('.progress .bar').css("width", file.upload.progress + "%");
- } else {
- $cut.find('.file-bytes').text('importiere...');
- $cut.find('.progress .bar').css('width', '100%');
- $cut.find('.progress').addClass('progress-striped').addClass('active');
- }
-};
-
Rivendell.Importer.prototype.importFileUploadSuccess = function(dropzone, file, group) {
//var command = { LOGIN_NAME: auth_username, PASSWORD: auth_token, DESCRIPTION: file. };