disable add annotation menu items if layer is not editable

This commit is contained in:
j 2017-02-15 15:31:25 +00:00
parent 9b8d45ba74
commit 21c94c00a9
2 changed files with 8 additions and 3 deletions

View file

@ -141,7 +141,7 @@ Ox.AnnotationFolder = function(options, self) {
click: function() { click: function() {
that.triggerEvent('add', {value: ''}); that.triggerEvent('add', {value: ''});
} }
}); });
self.$infoButton = Ox.Button({ self.$infoButton = Ox.Button({
style: 'symbol', style: 'symbol',
@ -456,7 +456,7 @@ Ox.AnnotationFolder = function(options, self) {
) && ( ) && (
self.options.languages == 'all' self.options.languages == 'all'
|| self.options.languages.some(function(language) { || self.options.languages.some(function(language) {
return item.languages.indexOf(language) > -1; return item.languages && item.languages.indexOf(language) > -1;
}) })
) && ( ) && (
self.options.users == 'all' self.options.users == 'all'

View file

@ -247,7 +247,12 @@ Ox.AnnotationPanel = function(options, self) {
self.$editMenuButton = Ox.MenuButton({ self.$editMenuButton = Ox.MenuButton({
items: [].concat( items: [].concat(
self.options.layers.map(function(layer, i) { self.options.layers.map(function(layer, i) {
return {id: 'add' + layer.id, title: Ox._('Add {0}', [layer.item]), keyboard: i < 9 ? i + 1 + '' : null} return {
id: 'add' + layer.id,
disabled: !layer.editable,
title: Ox._('Add {0}', [layer.item]),
keyboard: i < 9 ? i + 1 + '' : null
}
}), }),
[ [
{}, {},