add delete entity dialog
This commit is contained in:
parent
e98b97842e
commit
c08e3a9a35
1 changed files with 43 additions and 0 deletions
43
static/js/deleteEntityDialog.js
Normal file
43
static/js/deleteEntityDialog.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
|
||||
'use strict';
|
||||
|
||||
pandora.ui.deleteEntityDialog = function(entities, callback) {
|
||||
|
||||
var string = Ox._(entities.length == 1 ? 'Entity' : 'Entities'),
|
||||
that = pandora.ui.iconDialog({
|
||||
buttons: [
|
||||
Ox.Button({
|
||||
id: 'keep',
|
||||
title: Ox._('Keep {0}', [string])
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
that.close();
|
||||
}
|
||||
}),
|
||||
Ox.Button({
|
||||
id: 'delete',
|
||||
title: Ox._('Delete {0}', [string])
|
||||
}).bindEvent({
|
||||
click: function() {
|
||||
that.close();
|
||||
pandora.api.removeEntity({
|
||||
ids: entities.map(function(file) {
|
||||
return file.id;
|
||||
})
|
||||
}, callback);
|
||||
}
|
||||
})
|
||||
],
|
||||
content: entities.length == 1
|
||||
? Ox._('Are you sure you want to delete the entity "{0}"?', [entities[0].name])
|
||||
: Ox._('Are you sure you want to delete {0} entities?', [entities.length]),
|
||||
keys: {enter: 'delete', escape: 'keep'},
|
||||
title: entities.length == 1
|
||||
? Ox._('Delete {0}', [string])
|
||||
: Ox._('Delete {0} Entities', [entities.length])
|
||||
});
|
||||
|
||||
return that;
|
||||
|
||||
};
|
Loading…
Reference in a new issue