summaryrefslogtreecommitdiff
path: root/www/js/musicpools.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/musicpools.js')
-rw-r--r--www/js/musicpools.js35
1 files changed, 24 insertions, 11 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js
index 4449865..400c0bd 100644
--- a/www/js/musicpools.js
+++ b/www/js/musicpools.js
@@ -170,16 +170,7 @@ Rdxport.MusicpoolView.prototype.uploadProgress = function(upload, file) {
$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 .progress-bar').css("width", file.upload.progress + "%");
- } else {
- $cart.find('.file-bytes').text('importiere...');
- $cart.find('.progress .progress-bar').css('width', '100%');
- $cart.find('.progress .progress-bar').addClass('progress-bar-striped').addClass('active');
- }
+ updateProgressBar($cart, upload);
};
Rdxport.MusicpoolView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) {
@@ -219,7 +210,12 @@ Rdxport.MusicpoolCartView = function(model) {
this.$spinner = null;
this.$el = null;
- this.render();
+ var upload = null;
+ if ((upload = importer.getUploadByCartNumber(this.model.number)) !== null) {
+ this.renderUploading(upload);
+ } else {
+ this.render();
+ }
};
Rdxport.MusicpoolCartView.prototype.render = function() {
@@ -263,6 +259,23 @@ Rdxport.MusicpoolCartView.prototype.render = function() {
.append($('<td>').addClass('text-center').append(deleteButton));
};
+Rdxport.MusicpoolCartView.prototype.renderUploading = function(upload) {
+ var $progressBar = $('.progressBarTemplate.musicpools').clone().removeClass('progressBarTemplate');
+ $('.file-name', $progressBar).text(this.model.title);
+ $('.cart-number', $progressBar).text(this.model.number);
+
+ this.$el = $('<tr>')
+ .attr('id', 'musicpool-' + this.model.number)
+ .html($progressBar.html())
+ .addClass('uploading');
+
+ $('button', this.$el).on('click', function() {
+ upload.cancel();
+ });
+
+ updateProgressBar(this.$el, upload);
+};
+
Rdxport.MusicpoolCartView.prototype.delete = function() {
this.$el.find('td:last').html(this.$spinner);