diff options
author | Peter Grassberger <petertheone@gmail.com> | 2016-02-22 17:21:52 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2016-02-22 17:21:52 (GMT) |
commit | 7262a8e91ca8bb14bf58af8f8cf89e351aff288e (patch) | |
tree | 22fef7f2e770da0933f2f59483def62e50c4367c /www | |
parent | 212c8cfbdaa51855ce8ec4f41f0b6bcf34373387 (diff) |
show import error in jingles and musicpools
Diffstat (limited to 'www')
-rw-r--r-- | www/js/importer.js | 4 | ||||
-rw-r--r-- | www/js/jingles.js | 41 | ||||
-rw-r--r-- | www/js/musicpools.js | 30 | ||||
-rw-r--r-- | www/js/shows.js | 24 |
4 files changed, 70 insertions, 29 deletions
diff --git a/www/js/importer.js b/www/js/importer.js index bac23f6..06caa1c 100644 --- a/www/js/importer.js +++ b/www/js/importer.js @@ -80,7 +80,9 @@ Rivendell.Importer.prototype.openModal = function(group, groupView, createCart, Rivendell.Importer.prototype.cancelAllUploads = function() { $.each(this.uploads, function(index, upload){ - upload.cancel(); + if (upload) { + upload.cancel(); + } }); }; diff --git a/www/js/jingles.js b/www/js/jingles.js index 0bb586c..ea010d0 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -148,10 +148,38 @@ Rivendell.JingleGroupView.prototype.uploadProgress = function(upload, file) { }; Rivendell.JingleGroupView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { - // todo + if (!file.cartNumber || !file.cutNumber) { + return; + } + var responseCode = xhr.status; + var errorString = xhr.statusText; + + //var xmlDoc = $.parseXML(msg); + //var msg = $(xmlDoc); + //var responseCode = msg.find('ResponseCode').text(); + //var errorString = msg.find('ErrorString').text(); + var reason = $('<span>').addClass('label').addClass('label-danger').text(responseCode).after($('<b>').html(' ' + errorString)); + + var dismiss_button = '<button class="btn btn-info btn-xs">' + + '<span class="glyphicon glyphicon-remove"></span> Ok</button>'; + + var status = $('<span class="label"></span>') + .addClass('label-danger').html('<span class="glyphicon glyphicon-fire"></span>'); + + var $errorRow = $('<tr>') + .attr('id', 'jingle-' + file.cartNumber + '-' + file.cutNumber) + .append($('<td>').html(status)) + .append($('<td>').text(file.cartNumber)) + .append($('<td>').addClass('file-name').text(file.name)) + .append($('<td>').append($('<b>').text('Import Fehler'))) + .append($('<td colspan="1">').append(reason)) + .append($('<td>').css('text-align', 'center').append(dismiss_button)); + + $('button', $errorRow).on('click', function() { + acknowledge(); + }); - // to this on ok click. - acknowledge(); + $('#jingle-' + file.cartNumber + '-' + file.cutNumber).replaceWith($errorRow); }; Rivendell.JingleCartView = function(model, groupView, active) { @@ -196,6 +224,13 @@ Rivendell.JingleCutView.prototype.render = function() { } var deleteButton = $('<button class="btn btn-danger btn-xs"><span class="glyphicon glyphicon-trash"></span> Löschen</button>'); + if (this.model.length == 0) { + status + .removeClass('label-success') + .addClass('label-danger') + .html('<span class="glyphicon glyphicon-fire"></span>'); + } + var self = this; moveButton.on('click', function() { self.move(); diff --git a/www/js/musicpools.js b/www/js/musicpools.js index 3a694b9..1a2c78d 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -183,10 +183,34 @@ Rivendell.MusicpoolView.prototype.uploadProgress = function(upload, file) { }; Rivendell.MusicpoolView.prototype.uploadError = function(upload, file, msg, xhr, acknowledge) { - // todo + if (!file.cartNumber) { + return; + } + var responseCode = xhr.status; + var errorString = xhr.statusText; + + //var xmlDoc = $.parseXML(msg); + //var msg = $(xmlDoc); + //var responseCode = msg.find('ResponseCode').text(); + //var errorString = msg.find('ErrorString').text(); + var reason = $('<span>').addClass('label').addClass('label-danger').text(responseCode).after($('<b>').html(' ' + errorString)); + + var dismiss_button = '<button class="btn btn-info btn-xs">' + + '<span class="glyphicon glyphicon-remove"></span> Ok</button>'; + + var $errorRow = $('<tr>') + .attr('id', 'musicpool-' + file.cartNumber) + .append($('<td>').text(file.cartNumber)) + .append($('<td>').addClass('file-name').text(file.name)) + .append($('<td>').append($('<b>').text('Import Fehler'))) + .append($('<td colspan="5">').append(reason)) + .append($('<td>').css('text-align', 'center').append(dismiss_button)); + + $('button', $errorRow).on('click', function() { + acknowledge(); + }); - // to this on ok click. - acknowledge(); + $('#musicpool-' + file.cartNumber).replaceWith($errorRow); }; Rivendell.MusicpoolCartView = function(model) { diff --git a/www/js/shows.js b/www/js/shows.js index 1897352..1ba86b9 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -24,19 +24,9 @@ var Rivendell = Rivendell || {}; -/*var shows_currentid = null; -var shows_list = []; -var shows_current; -var shows_group_carts = {}; -var shows_log_carts = [];*/ - var showListView = null; function shows_init() { - /*shows_currentid = sessionStorage.getItem("shows_currentid"); - shows_list = []; - rdxport.listDropboxes('show', shows_updateList);*/ - var showList = new Rivendell.GroupList(); showListView = new Rivendell.ShowListView(showList); @@ -47,12 +37,6 @@ function shows_init() { function shows_cleanup() { $('#show-carts tbody').find('tr').remove(); importer.cancelAllUploads(); - - /*sessionStorage.removeItem("shows_currentid"); - shows_currentid = null; - shows_list = []; - shows_group_carts = {}; - shows_log_carts = [];*/ } Rivendell.ShowListView = function(model) { @@ -277,15 +261,12 @@ Rivendell.ShowView.prototype.uploadError = function(upload, file, msg, xhr, ackn var $errorRow = $('<tr>') .attr("id", "show-cart-" + file.cartNumber) .append($('<td>').text(file.cartNumber)) - .append($('<td>').addClass('file-name').text('-')) + .append($('<td>').addClass('file-name').text(file.name)) .append($('<td>').append($('<b>').text('Import Fehler'))) - .append($('<td colspan=3>').append(reason)) + .append($('<td colspan="3">').append(reason)) .append($('<td>').css('text-align', 'center').append(dismiss_button)); - var self = this; $('button', $errorRow).on('click', function() { - var $emptyRow = Rivendell.ShowCartView.renderEmpty(self.model, self, file.cartNumber); - $('#show-cart-' + file.cartNumber).replaceWith($emptyRow); acknowledge(); }); @@ -360,4 +341,3 @@ Rivendell.ShowCartView.prototype.delete = function() { self.$el.replaceWith($empty); }); }; - |