diff options
Diffstat (limited to 'www/js/musicpools.js')
-rw-r--r-- | www/js/musicpools.js | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js index 5b3d491..0ce1c9c 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -32,7 +32,7 @@ function musicpools_init(subpage) { } function musicpools_cleanup() { - importer.cancelAllUploads(); + importer.closeAllUploads(); musicpoolsView = null; } @@ -167,20 +167,23 @@ Rdxport.MusicpoolView.prototype.render = function() { $('table > tbody', self.$el).append(cartView.$el); }); + var uploads = importer.getUploadsByGroupName(this.model.name); + $(uploads).each(function(index, upload) { + var $el = Rdxport.MusicpoolCartView.renderUploading(upload, self.model.number); + $('table > tbody', self.$el).append($el); + }); + $('.uploadButton', this.$el).on('click', function() { - importer.openModal(self.model, self, true, null, true); + importer.openModal(self.model, self, null, null, true); }); }; Rdxport.MusicpoolView.prototype.uploadProgress = function(upload, file) { - if (!file.cartNumber || !file.cutNumber) { - return; - } - var $cart = $('#musicpool-' + file.cartNumber).first(); + var $cart = $('tr[data-upload-id="' + upload.uploadId + '"]').first(); if (!$cart.hasClass('uploading')) { var $progressBar = $('.progressBarTemplate.musicpools').clone().removeClass('progressBarTemplate'); - $('.file-name', $progressBar).text(file.name); + $('.file-name', $progressBar).text(upload.filename); $('.cart-number', $progressBar).text(file.cartNumber); $cart.html($progressBar.html()); @@ -213,7 +216,7 @@ Rdxport.MusicpoolView.prototype.uploadError = function(upload, file, msg, xhr, a var $errorRow = $('<tr>') .attr('id', 'musicpool-' + file.cartNumber) .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="5">').append(reason)) .append($('<td>').css('text-align', 'center').append(dismiss_button)); @@ -231,12 +234,7 @@ Rdxport.MusicpoolCartView = function(model) { this.$spinner = null; this.$el = null; - var upload = null; - if ((upload = importer.getUploadByCartNumber(this.model.number)) !== null) { - this.renderUploading(upload); - } else { - this.render(); - } + this.render(); }; Rdxport.MusicpoolCartView.prototype.render = function() { @@ -280,21 +278,22 @@ Rdxport.MusicpoolCartView.prototype.render = function() { .append($('<td>').addClass('text-center').append(deleteButton)); }; -Rdxport.MusicpoolCartView.prototype.renderUploading = function(upload) { +Rdxport.MusicpoolCartView.renderUploading = function(upload) { var $progressBar = $('.progressBarTemplate.musicpools').clone().removeClass('progressBarTemplate'); - $('.file-name', $progressBar).text(this.model.title); - $('.cart-number', $progressBar).text(this.model.number); + $('.file-name', $progressBar).text(upload.filename); - this.$el = $('<tr>') - .attr('id', 'musicpool-' + this.model.number) + var $el = $('<tr>') .html($progressBar.html()) - .addClass('uploading'); + .attr('id', 'musicpool-upload-' + upload.uploadId) + .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.MusicpoolCartView.prototype.delete = function() { |