honor capabilities when constructing find select (no filename if not staff or admin); fix a bug where after app panel reload, a non-existing menu would still be bound to all keyboard events

This commit is contained in:
rolux 2011-11-07 19:09:20 +00:00
parent f5aadf2267
commit d378b130f0
2 changed files with 7 additions and 5 deletions

View file

@ -26,12 +26,14 @@ pandora.ui.findElement = function() {
pandora.$ui.findSelect = Ox.Select({ pandora.$ui.findSelect = Ox.Select({
id: 'select', id: 'select',
items: Ox.merge( items: Ox.merge(
pandora.site.findKeys.map(function(key, i) { Ox.map(pandora.site.findKeys, function(key, i) {
return { return !key.capability
|| pandora.site.capabilities[key.capability][pandora.user.level]
? {
id: key.id, id: key.id,
title: 'Find: ' + key.title, title: 'Find: ' + key.title,
checked: findKey == key.id checked: findKey == key.id
}; } : null;
}), }),
[{}, { [{}, {
id: 'advanced', id: 'advanced',

View file

@ -64,10 +64,10 @@ pandora.ui.siteDialog = function(section) {
$dialog.options({ $dialog.options({
title: Ox.getObjectById(tabs, data.selected).title title: Ox.getObjectById(tabs, data.selected).title
}); });
pandora.URL.replace('/' + data.selected); //pandora.URL.replace('/' + data.selected);
//fixme: this should be using URL.push / UI.set //fixme: this should be using URL.push / UI.set
//but that currenlty causes another dialog to be opened //but that currenlty causes another dialog to be opened
//history.pushState({}, '', '/' + data.selected); history.pushState({}, '', '/' + data.selected);
} }
}); });
var $dialog = Ox.Dialog({ var $dialog = Ox.Dialog({