allow uploading/deleting multiple documents, fixes #1960. replace select option with item aware add button, fixes #1961

This commit is contained in:
j 2014-01-02 10:11:27 +00:00
commit 19b8bcfc83
5 changed files with 135 additions and 109 deletions

View file

@ -1,13 +1,13 @@
// vim: et:ts=4:sw=4:sts=4:ft=javascript
'use strict';
pandora.ui.deleteDocumentDialog = function(file, callback) {
pandora.ui.deleteDocumentDialog = function(files, callback) {
var that = pandora.ui.iconDialog({
buttons: [
Ox.Button({
id: 'keep',
title: Ox._('Keep Document')
title: files.length == 1 ? Ox._('Keep Document') : Ox._('Keep Documents')
}).bindEvent({
click: function() {
that.close();
@ -15,19 +15,21 @@ pandora.ui.deleteDocumentDialog = function(file, callback) {
}),
Ox.Button({
id: 'delete',
title: Ox._('Delete Document')
title: files.length == 1 ? Ox._('Delete Document') : Ox._('Delete Documents')
}).bindEvent({
click: function() {
that.close();
pandora.api.removeDocument({
id: file
ids: files
}, callback);
}
})
],
content: Ox._('Are you sure you want to delete the document "{0}"?', [file]),
content: files.length == 1
? Ox._('Are you sure you want to delete the document "{0}"?', [files[0]])
: Ox._('Are you sure you want to delete {0} documents?', [files.length]),
keys: {enter: 'delete', escape: 'keep'},
title: Ox._('Delete Document')
title: files.length == 1 ? Ox._('Delete Document') : Ox._('Delete {0} Documents', [files.length])
});
return that;