Annotation Panel: on edit, update languages in menu

This commit is contained in:
rlx 2014-09-02 16:12:55 +02:00
parent 923a9ea706
commit 28d8a0ddf0

View file

@ -557,6 +557,18 @@ Ox.AnnotationPanel = function(options, self) {
self.$editMenuButton[action]('delete');
}
function updateLanguages() {
var languages = self.languages,
enabledLanguages = self.enabledLanguages;
self.languages = getLanguages();
self.enabledLanguages = self.languages.filter(function(language) {
return Ox.contains(enabledLanguages, language)
|| !Ox.contains(languages, language);
}).map(function(language) {
return language.code;
});
}
/*@
addItem <f> add item
(layer, item) -> <o> AnnotationPanel
@ -565,7 +577,7 @@ Ox.AnnotationPanel = function(options, self) {
// called from addannotation callback
var i = Ox.getIndexById(self.options.layers, layer);
self.$folder[i].addItem(item);
self.languages = getLanguages();
updateLanguages();
self.users = getUsers();
if (self.enabledUsers != 'all' && self.enabledUsers.indexOf(item.user) == -1) {
self.enabledUsers.push(item.user);
@ -621,7 +633,7 @@ Ox.AnnotationPanel = function(options, self) {
} else {
// called from removeannotation callback
self.options.selected = '';
self.languages = getLanguages();
updateLanguages();
self.users = getUsers();
renderOptionsMenu();
renderEditMenu();
@ -653,7 +665,10 @@ Ox.AnnotationPanel = function(options, self) {
// on the first update of a new annotation, the id will change
self.options.selected = item.id;
getFolder(id).updateItem(id, item);
updateLanguages();
renderOptionsMenu();
renderEditMenu();
return that;
};
/*@