add and use iconDialog

This commit is contained in:
rolux 2013-03-03 10:34:25 +05:30
parent d4074629d9
commit 7a43ab4e54
2 changed files with 44 additions and 19 deletions

View file

@ -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(
$('<img>')
.attr({src: '/static/png/icon.png'})
.css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'})
)
.append(
$('<div>')
.css({position: 'absolute', left: '96px', top: '16px', width: '256px'})
.html('Are you sure you want to delete the '
+ pandora.site.itemName.singular
+ ' "'+ item.title + '"?<br><br>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 + '"?<br><br>All data will be removed.',
title: 'Delete ' + pandora.site.itemName.singular
});
return that;
};

View file

@ -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(
$('<img>')
.attr({src: '/static/png/icon.png'})
.css({position: 'absolute', left: '16px', top: '16px', width: '64px', height: '64px'})
)
.append(
$('<div>')
.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;
};