diff options
author | Peter Grassberger <petertheone@gmail.com> | 2016-04-01 15:30:45 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2016-04-01 15:30:45 (GMT) |
commit | 8db94592d6222fbd0153cf05c83724d7ac518634 (patch) | |
tree | fe89e9ed21ce849f3f5fcbfecff335d1cc90f409 /www/js/jingles.js | |
parent | 3c584d7ee53ecfb35f32a2182971dfbc30009590 (diff) | |
parent | 4a79af6bf48f7543a407d86fc73ce70f39fc6d94 (diff) |
Merge branch 'master' into rdxportjs-refactor
Conflicts:
www/js/importer.js
www/js/jingles.js
www/js/musicpools.js
www/js/shows.js
Diffstat (limited to 'www/js/jingles.js')
-rw-r--r-- | www/js/jingles.js | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js index 72522c4..02070ae 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -135,16 +135,7 @@ Rdxport.JingleGroupView.prototype.uploadProgress = function(upload, file) { $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 .progress-bar').css("width", file.upload.progress + "%"); - } else { - $cut.find('.file-bytes').text('importiere...'); - $cut.find('.progress .progress-bar').css('width', '100%'); - $cut.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active'); - } + updateProgressBar($cut, upload); }; Rdxport.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { @@ -208,7 +199,12 @@ Rdxport.JingleCutView = function(model) { this.$spinner = null; this.$el = null; - this.render(); + var upload = null; + if ((upload = importer.getUploadByCartAndCutNumber(this.model.cartNumber, this.model.number)) !== null) { + this.renderUploading(upload); + } else { + this.render(); + } }; Rdxport.JingleCutView.prototype.render = function() { @@ -259,6 +255,23 @@ Rdxport.JingleCutView.prototype.render = function() { ); }; +Rdxport.JingleCutView.prototype.renderUploading = function(upload) { + var $progressBar = $('.progressBarTemplate.jingles').clone().removeClass('progressBarTemplate'); + $('.file-name', $progressBar).text(this.model.name); + $('.cart-number', $progressBar).text(this.model.number); + + this.$el = $('<tr>') + .attr('id', 'jingle-' + this.model.cartNumber + '-' + this.model.number) + .html($progressBar.html()) + .addClass('uploading'); + + $('button', this.$el).on('click', function() { + upload.cancel(); + }); + + updateProgressBar(this.$el, upload); +}; + Rdxport.JingleCutView.prototype.move = function() { this.$el.find('td:first').html(this.$spinner); var self = this; |