diff --git a/static/js/pandora/deleteItemDialog.js b/static/js/pandora/deleteItemDialog.js index 057f6e17..6845f786 100644 --- a/static/js/pandora/deleteItemDialog.js +++ b/static/js/pandora/deleteItemDialog.js @@ -2,8 +2,8 @@ 'use strict'; pandora.ui.deleteItemDialog = function(item) { - var - that = Ox.Dialog({ + + var that = pandora.ui.iconDialog({ buttons: [ Ox.Button({ id: 'keep', @@ -28,25 +28,13 @@ pandora.ui.deleteItemDialog = function(item) { } }) ], - content: Ox.Element() - .append( - $('') - .attr({src: '/static/png/icon.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 removed.') - ), - height: 128, keys: {enter: 'delete', escape: 'keep'}, - removeOnClose: true, - title: 'Delete ' + pandora.site.itemName.singular, - width: 368 + text: 'Are you sure you want to delete the ' + + pandora.site.itemName.singular + + ' "'+ item.title + '"?

All data will be removed.', + title: 'Delete ' + pandora.site.itemName.singular }); + return that; }; diff --git a/static/js/pandora/iconDialog.js b/static/js/pandora/iconDialog.js new file mode 100644 index 00000000..9be55243 --- /dev/null +++ b/static/js/pandora/iconDialog.js @@ -0,0 +1,37 @@ +'use strict'; + +pandora.iconDialog = function(options) { + + var options = Ox.extend({ + closeButton: false, + height: 128, + keys: null, + text: '', + title: '', + width: 368, + }, options), + + that = Ox.Dialog({ + buttons: options.buttons, + content: Ox.Element() + .append( + $('') + .attr({src: '/static/png/icon.png'}) + .css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'}) + ) + .append( + $('
') + .css({position: 'absolute', left: '96px', top: '16px', width: width - 112 + 'px'}) + .html(options.text) + ), + fixedSize: true + height: options.height, + keys: options.keys, + removeOnClose: true, + title: options.title, + width: options.width + }); + + return that; + +}; \ No newline at end of file