diff --git a/static/js/pandora/deleteItemDialog.js b/static/js/pandora/deleteItemDialog.js new file mode 100644 index 00000000..e86a2ab0 --- /dev/null +++ b/static/js/pandora/deleteItemDialog.js @@ -0,0 +1,53 @@ +// vim: et:ts=4:sw=4:sts=4:ft=javascript +'use strict'; + +pandora.ui.deleteItemDialog = function(item) { + var + that = Ox.Dialog({ + buttons: [ + Ox.Button({ + id: 'keep', + title: 'Keep ' + pandora.site.itemName.singular + }).bindEvent({ + click: function() { + that.close(); + } + }), + Ox.Button({ + id: 'delete', + title: 'Delete ' + pandora.site.itemName.singular + }).bindEvent({ + click: function() { + that.close(); + pandora.api.remove({ + id: item.id + }, function(result) { + Ox.Request.clearCache(); + pandora.UI.set({item: ''}); + }); + } + }) + ], + content: Ox.Element() + .append( + $('') + .attr({src: '/static/png/icon64.png'}) + .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) + ) + .append( + $('
') + .css({position: 'absolute', left: '96px', top: '16px', width: '256px'}) + .html('Are you sure you want to delete the ' + + pandora.site.itemName.singular + + ' "'+ item.title + '"?

All data will be lost.') + ), + height: 128, + keys: {enter: 'delete', escape: 'keep'}, + removeOnClose: true, + title: 'Delete ' + pandora.site.itemName.singular, + width: 368 + }); + return that; + +}; + diff --git a/static/js/pandora/filesView.js b/static/js/pandora/filesView.js index 836a676a..a69f5340 100644 --- a/static/js/pandora/filesView.js +++ b/static/js/pandora/filesView.js @@ -37,6 +37,20 @@ pandora.ui.filesView = function(options, self) { }) .appendTo(self.$toolbar); */ + self.$deleteButton = Ox.Button({ + disabled: false, + title: 'Delete ' + pandora.site.itemName.singular, + width: 116 + }) + .css({ + float: 'right', + margin: '4px' + }) + .appendTo(self.$toolbar) + .bindEvent({ + click: deleteItem + }); + self.$ignoreButton = Ox.Button({ disabled: 'true', title: 'Ignore Selected Files...' @@ -369,6 +383,7 @@ pandora.ui.filesView = function(options, self) { .bindEvent({ click: moveFiles }); + self.$moviePanel = Ox.Element() .append(self.$movieLabel) @@ -405,6 +420,15 @@ pandora.ui.filesView = function(options, self) { orientation: 'horizontal' }); + function deleteItem(data) { + pandora.api.get({ + id: pandora.user.ui.item, + keys: ['id', 'title'] + },function(result) { + pandora.ui.deleteItemDialog(result.data).open(); + }); + } + function moveFiles(data) { var data = { ids: self.selected,