summaryrefslogtreecommitdiff
path: root/www/js/jingles.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/jingles.js')
-rw-r--r--www/js/jingles.js43
1 files changed, 18 insertions, 25 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js
index 48c7f13..b82166f 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -29,7 +29,6 @@ var jingleGroupListView = null;
function jingles_init() {
var groupList = new Rdxport.GroupList();
jingleGroupListView = new Rdxport.JingleGroupListView(groupList);
- importer.updateWebsocketUploads();
}
function jingles_cleanup() {
@@ -57,7 +56,6 @@ Rdxport.JingleGroupListView = function(model) {
};
Rdxport.JingleGroupListView.prototype.destroy = function() {
- var self = this;
$(this.jingleGroupViews).each(function(index, groupView) {
groupView.destroy();
});
@@ -110,7 +108,7 @@ Rdxport.JingleGroupView.prototype.render = function() {
$('table tbody tr', this.$el).remove();
$('.uploadButton', this.$el).on('click', function() {
- importer.openModal(self.model, self, false, null, false);
+ importer.openModal(self.model, self, self.model.carts[0].number, null, false);
});
};
@@ -119,14 +117,10 @@ Rdxport.JingleGroupView.prototype.destroy = function() {
};
Rdxport.JingleGroupView.prototype.uploadProgress = function(upload, file) {
- if (!file.cartNumber || !file.cutNumber) {
- return;
- }
- var $cut = $('#jingle-' + file.cartNumber + '-' + file.cutNumber).first();
+ var $cut = $('tr[data-upload-id="' + upload.uploadId + '"]').first();
if (!$cut.hasClass('uploading')) {
var $progressBar = $('.progressBarTemplate.jingles').clone().removeClass('progressBarTemplate');
- $('.file-name', $progressBar).text(file.name);
- $('.cart-number', $progressBar).text(file.cartNumber);
+ $('.file-name', $progressBar).text(upload.filename);
$cut.html($progressBar.html());
$('button', $cut).on('click', function() {
@@ -162,7 +156,7 @@ Rdxport.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr,
.attr('id', 'jingle-' + file.cartNumber + '-' + file.cutNumber)
.append($('<td>').html(status))
.append($('<td>').text(file.cartNumber))
- .append($('<td>').addClass('file-name').text(file.name))
+ .append($('<td>').addClass('file-name').text(upload.filename))
.append($('<td>').append($('<b>').text('Import Fehler')))
.append($('<td colspan="1">').append(reason))
.append($('<td>').css('text-align', 'center').append(dismiss_button));
@@ -191,6 +185,11 @@ Rdxport.JingleCartView = function(model, groupView, active) {
$('table > tbody', self.groupView.$el).append(cutView.$el);
});
+ var uploads = importer.getUploadsByCartNumber(this.model.number);
+ $(uploads).each(function(index, upload) {
+ var $el = Rdxport.JingleCutView.renderUploading(upload, self.model.number);
+ $('table > tbody', self.groupView.$el).append($el);
+ });
}
};
@@ -199,13 +198,7 @@ Rdxport.JingleCutView = function(model) {
this.$spinner = null;
this.$el = null;
-
- var upload = null;
- if ((upload = importer.getUploadByCartAndCutNumber(this.model.cartNumber, this.model.number)) !== null) {
- this.renderUploading(upload);
- } else {
- this.render();
- }
+ this.render();
};
Rdxport.JingleCutView.prototype.render = function() {
@@ -256,21 +249,21 @@ Rdxport.JingleCutView.prototype.render = function() {
);
};
-Rdxport.JingleCutView.prototype.renderUploading = function(upload) {
+Rdxport.JingleCutView.renderUploading = function(upload) {
var $progressBar = $('.progressBarTemplate.jingles').clone().removeClass('progressBarTemplate');
- $('.file-name', $progressBar).text(this.model.name);
- $('.cart-number', $progressBar).text(this.model.number);
+ $('.file-name', $progressBar).text(upload.filename);
- this.$el = $('<tr>')
- .attr('id', 'jingle-' + this.model.cartNumber + '-' + this.model.number)
+ var $el = $('<tr>')
.html($progressBar.html())
- .addClass('uploading');
+ .addClass('uploading')
+ .attr('data-upload-id', upload.uploadId);
- $('button', this.$el).on('click', function() {
+ $('button', $el).on('click', function() {
upload.cancel();
});
- updateProgressBar(this.$el, upload);
+ updateProgressBar($el, upload);
+ return $el;
};
Rdxport.JingleCutView.prototype.move = function() {