remove annotations and other annotation menu options
This commit is contained in:
parent
8169d8e720
commit
b4b66f9bd5
4 changed files with 88 additions and 11 deletions
48
static/js/removeAnnotations.js
Normal file
48
static/js/removeAnnotations.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
'use strict';
|
||||
|
||||
oml.ui.removeAnnotationsDialog = function() {
|
||||
|
||||
var ui = oml.user.ui,
|
||||
|
||||
annotations = oml.$ui.viewer.getAnnotations().filter(function(a) {
|
||||
return a.user == oml.user.id
|
||||
}),
|
||||
annotationsName = Ox._(annotations.length == 1 ? 'Annotation' : 'Annotations'),
|
||||
theseAnnotationsName = annotations.length == 1
|
||||
? Ox._('this annotation')
|
||||
: Ox._('these {0} annotations', [Ox.formatNumber(annotations.length)]),
|
||||
|
||||
that = oml.ui.confirmDialog({
|
||||
buttons: [
|
||||
Ox.Button({
|
||||
style: 'squared',
|
||||
title: Ox._('No, Keep {0}', [annotationsName])
|
||||
}),
|
||||
Ox.Button({
|
||||
style: 'squared',
|
||||
title: Ox._('Yes, Delete {0}', [annotationsName])
|
||||
})
|
||||
],
|
||||
content: Ox._(
|
||||
'Are you sure that you want to permanently delete {0}?',
|
||||
[theseAnnotationsName]
|
||||
),
|
||||
title: Ox._('Delete {0}', [annotationsName])
|
||||
}, function() {
|
||||
Ox.serialForEach(annotations, function(a, index, annotations, next) {
|
||||
oml.api.removeAnnotation({
|
||||
item: ui.item,
|
||||
annotation: a.id
|
||||
}, function(result) {
|
||||
next()
|
||||
})
|
||||
}, function() {
|
||||
Ox.Request.clearCache();
|
||||
oml.$ui.viewer.renderAnnotations(true);
|
||||
})
|
||||
});
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue