diff options
Diffstat (limited to 'www/js/musicpools.js')
-rw-r--r-- | www/js/musicpools.js | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js index 27de48e..bf906d0 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -151,12 +151,36 @@ Rivendell.MusicpoolView.prototype.render = function() { $('table > tbody', self.$el).append(cartView.$el); }); - // todo $('.uploadButton', this.$el).on('click', function() { - importer.openModal(self.model, true, true); + importer.openModal(self.model, self, true, true); }); }; +Rivendell.MusicpoolView.prototype.uploadProgress = function(file) { + if (!file.cartNumber || !file.cutNumber) { + return; + } + var $cart = $('#musicpool-' + file.cartNumber).first(); + if (!$cart.hasClass('uploading')) { + var $progressBar = $('.progressBarTemplate.musicpools').clone().removeClass('progressBarTemplate'); + $progressBar.find('.file-name').text(file.name); + $progressBar.find('.cart-number').text(file.cartNumber); + $cart.html($progressBar.html()); + $cart.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"; + $cart.find('.file-bytes').text(bytes_str); + $cart.find('.progress .bar').css("width", file.upload.progress + "%"); + } else { + $cart.find('.file-bytes').text('importiere...'); + $cart.find('.progress .bar').css('width', '100%'); + $cart.find('.progress').addClass('progress-striped').addClass('active'); + } +}; + Rivendell.MusicpoolCartView = function(model) { this.model = model; @@ -177,7 +201,7 @@ Rivendell.MusicpoolCartView.prototype.render = function() { if (this.model.cuts.length > 0) { var cut = this.model.cuts[0]; - //title = this.model.cuts[0].description; + title = this.model.cuts[0].description; length = msToTimeString(Number(cut.length)); imported = format_datetime(new Date(cut.originDatetime)); @@ -194,13 +218,14 @@ Rivendell.MusicpoolCartView.prototype.render = function() { this.$el = $('<tr>') - .append($('<td>').text(number)) - .append($('<td>').text(title)) - .append($('<td>').text(length)) - .append($('<td>').text(imported)) - .append($('<td>').text(playcnt)) - .append($('<td>').text(lastplayed)) - .append($('<td>').append(deleteButton)); + .attr('id', 'musicpool-' + this.model.number) + .append($('<td>').text(number)) + .append($('<td>').text(title)) + .append($('<td>').text(length)) + .append($('<td>').text(imported)) + .append($('<td>').text(playcnt)) + .append($('<td>').text(lastplayed)) + .append($('<td>').append(deleteButton)); }; Rivendell.MusicpoolCartView.prototype.delete = function() { |