add 'Show All Users' and 'Show No Users'

This commit is contained in:
rolux 2015-04-15 18:20:07 +01:00
parent 5958b9f408
commit cd34cc5c6e

View file

@ -456,8 +456,10 @@ Ox.AnnotationPanel = function(options, self) {
{}, {},
{id: 'languages', title: Ox._('Show Languages'), disabled: true}, {id: 'languages', title: Ox._('Show Languages'), disabled: true},
{group: 'languages', min: 1, max: -1, items: self.languages.map(function(language) { {group: 'languages', min: 1, max: -1, items: self.languages.map(function(language) {
return {id: language.code, title: Ox._(language.name), checked: return {
self.enabledLanguages.indexOf(language.code) > -1 id: language.code,
title: Ox._(language.name),
checked: Ox.contains(self.enabledLanguages, language.code)
}; };
})} })}
] : [], ] : [],
@ -465,10 +467,17 @@ Ox.AnnotationPanel = function(options, self) {
{}, {},
{id: 'users', title: Ox._('Show Users'), disabled: true}, {id: 'users', title: Ox._('Show Users'), disabled: true},
{group: 'users', min: 1, max: -1, items: self.users.map(function(user) { {group: 'users', min: 1, max: -1, items: self.users.map(function(user) {
return {id: user, title: Ox.encodeHTMLEntities(user), checked: return {
self.enabledUsers == 'all' || self.enabledUsers.indexOf(user) > -1 id: 'user_' + user,
title: Ox.encodeHTMLEntities(user),
checked: self.enabledUsers == 'all' || Ox.contains(self.enabledUsers, user)
}; };
})} })}
] : [],
self.options.showUsers && self.users.length > 1 ? [
{},
{id: 'allusers', title: Ox._('Show All Users')},
{id: 'nousers', title: Ox._('Show No Users')}
] : [] ] : []
), ),
style: 'square', style: 'square',
@ -489,11 +498,19 @@ Ox.AnnotationPanel = function(options, self) {
}); });
} else if (data.id == 'users') { } else if (data.id == 'users') {
self.enabledUsers = data.checked.map(function(checked) { self.enabledUsers = data.checked.map(function(checked) {
return checked.id; return checked.id.slice(5);
}); });
self.$folder.forEach(function($folder) { self.$folder.forEach(function($folder) {
$folder.options({users: self.enabledUsers}); $folder.options({users: self.enabledUsers});
}); });
} else if (data.id == 'allusers') {
self.users.forEach(function(user) {
self.$optionsMenuButton.checkItem('user_' + user);
});
} else if (data.id == 'nousers') {
self.users.forEach(function(user) {
self.$optionsMenuButton.uncheckItem('user_' + user);
});
} else { } else {
self.options[data.id] = data.checked[0].id; self.options[data.id] = data.checked[0].id;
set[data.id] = self.options[data.id]; set[data.id] = self.options[data.id];