From 7a43ab4e5406bef40c3d44de09319c4e184a0947 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 3 Mar 2013 10:34:25 +0530 Subject: [PATCH] add and use iconDialog --- static/js/pandora/deleteItemDialog.js | 26 +++++-------------- static/js/pandora/iconDialog.js | 37 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 19 deletions(-) create mode 100644 static/js/pandora/iconDialog.js diff --git a/static/js/pandora/deleteItemDialog.js b/static/js/pandora/deleteItemDialog.js index 057f6e179..6845f786b 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 000000000..9be552431 --- /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