summaryrefslogtreecommitdiff
path: root/www/js/jingles.js
diff options
context:
space:
mode:
authorPeter Grassberger <petertheone@gmail.com>2016-03-24 16:58:34 (GMT)
committerPeter Grassberger <petertheone@gmail.com>2016-03-24 16:58:34 (GMT)
commitd67d45412f398b074d3cb2762d98c4139b0ab9bd (patch)
treef2730f75bba2591bf0b6c79624f5c6a03daf37a9 /www/js/jingles.js
parent2396977fd57fee58eec84ce0ac6fc91b1b0d1dc9 (diff)
jingles, musicpools: fix renderUploading
Diffstat (limited to 'www/js/jingles.js')
-rw-r--r--www/js/jingles.js35
1 files changed, 24 insertions, 11 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js
index 4748df8..7910b97 100644
--- a/www/js/jingles.js
+++ b/www/js/jingles.js
@@ -135,16 +135,7 @@ Rivendell.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);
};
Rivendell.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) {
@@ -208,7 +199,12 @@ Rivendell.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();
+ }
};
Rivendell.JingleCutView.prototype.render = function() {
@@ -259,6 +255,23 @@ Rivendell.JingleCutView.prototype.render = function() {
);
};
+Rivendell.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);
+};
+
Rivendell.JingleCutView.prototype.move = function() {
this.$el.find('td:first').html(this.$spinner);
var self = this;