diff options
Diffstat (limited to 'www/js/musicpools.js')
-rw-r--r-- | www/js/musicpools.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/www/js/musicpools.js b/www/js/musicpools.js index b9f9107..27de48e 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -185,8 +185,13 @@ Rivendell.MusicpoolCartView.prototype.render = function() { lastplayed = format_datetime(new Date(cut.lastPlayDatetime)); } - //todo - var actions = ''; + var deleteButton = $('<button class="btn btn-danger btn-mini"><i class="icon-trash icon-white"></i> Löschen</button>'); + + var self = this; + deleteButton.on('click', function() { + self.delete(); + }); + this.$el = $('<tr>') .append($('<td>').text(number)) @@ -195,6 +200,13 @@ Rivendell.MusicpoolCartView.prototype.render = function() { .append($('<td>').text(imported)) .append($('<td>').text(playcnt)) .append($('<td>').text(lastplayed)) - .append($('<td>').text(actions)); + .append($('<td>').append(deleteButton)); }; +Rivendell.MusicpoolCartView.prototype.delete = function() { + var self = this; + rivendell.removeCart(this.model.number, function() { + self.model.group.removeCart(self.model); + self.$el.remove(); + }); +}; |