fix #2278 (JS error when switching find while not in items section)
This commit is contained in:
parent
aea9d1a439
commit
ef9f23226f
1 changed files with 19 additions and 14 deletions
|
@ -196,20 +196,7 @@ pandora.ui.mainMenu = function() {
|
||||||
] }
|
] }
|
||||||
]},
|
]},
|
||||||
getSortMenu(),
|
getSortMenu(),
|
||||||
{ id: 'findMenu', title: Ox._('Find'), items: [
|
getFindMenu(),
|
||||||
{ id: 'find', title: Ox._('Find'), items: [
|
|
||||||
{ group: 'find', min: 0, max: 1, items: pandora.site.findKeys.map(function(key, i) {
|
|
||||||
return {
|
|
||||||
id: key.id,
|
|
||||||
checked: key.id == findState.key,
|
|
||||||
title: Ox._(key.title)
|
|
||||||
};
|
|
||||||
}) }
|
|
||||||
] },
|
|
||||||
{ id: 'advancedfind', title: Ox._('Advanced Find...'), keyboard: 'shift control f' },
|
|
||||||
{},
|
|
||||||
{ id: 'findsimilar', title: Ox._('Find Similar Clips...'), keyboard: 'alt control f', disabled: !pandora.getItemIdAndPosition() }
|
|
||||||
] },
|
|
||||||
{ id: 'dataMenu', title: Ox._('Data'), items: [
|
{ id: 'dataMenu', title: Ox._('Data'), items: [
|
||||||
{ id: 'documents', title: Ox._('Manage Documents...'), disabled: !pandora.site.capabilities.canManageDocuments[pandora.user.level] },
|
{ id: 'documents', title: Ox._('Manage Documents...'), disabled: !pandora.site.capabilities.canManageDocuments[pandora.user.level] },
|
||||||
{},
|
{},
|
||||||
|
@ -793,6 +780,7 @@ pandora.ui.mainMenu = function() {
|
||||||
that.replaceMenu('listMenu', getListMenu());
|
that.replaceMenu('listMenu', getListMenu());
|
||||||
that.replaceMenu('itemMenu', getItemMenu());
|
that.replaceMenu('itemMenu', getItemMenu());
|
||||||
that.replaceMenu('sortMenu', getSortMenu());
|
that.replaceMenu('sortMenu', getSortMenu());
|
||||||
|
that.replaceMenu('findMenu', getFindMenu());
|
||||||
},
|
},
|
||||||
pandora_showannotations: function(data) {
|
pandora_showannotations: function(data) {
|
||||||
that.setItemTitle('showannotations', Ox._((data.value ? 'Hide' : 'Show') + ' Annotations'));
|
that.setItemTitle('showannotations', Ox._((data.value ? 'Hide' : 'Show') + ' Annotations'));
|
||||||
|
@ -905,6 +893,23 @@ pandora.ui.mainMenu = function() {
|
||||||
elements[Ox.mod((index + direction), elements.length)].gainFocus();
|
elements[Ox.mod((index + direction), elements.length)].gainFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFindMenu() {
|
||||||
|
return { id: 'findMenu', title: Ox._('Find'), items: [
|
||||||
|
{ id: 'find', title: Ox._('Find'), items: [
|
||||||
|
{ group: 'find', min: 0, max: 1, items: pandora.site.findKeys.map(function(key, i) {
|
||||||
|
return {
|
||||||
|
id: key.id,
|
||||||
|
checked: key.id == findState.key,
|
||||||
|
title: Ox._(key.title)
|
||||||
|
};
|
||||||
|
}) }
|
||||||
|
], disabled: ui.section != 'items' },
|
||||||
|
{ id: 'advancedfind', title: Ox._('Advanced Find...'), keyboard: 'shift control f', disabled: ui.section != 'items' },
|
||||||
|
{},
|
||||||
|
{ id: 'findsimilar', title: Ox._('Find Similar Clips...'), keyboard: 'alt control f', disabled: !pandora.getItemIdAndPosition() }
|
||||||
|
] };
|
||||||
|
}
|
||||||
|
|
||||||
function getItemMenu() {
|
function getItemMenu() {
|
||||||
var listData = pandora.getListData(),
|
var listData = pandora.getListData(),
|
||||||
isEditable = listData.editable && listData.type == 'static',
|
isEditable = listData.editable && listData.type == 'static',
|
||||||
|
|
Loading…
Reference in a new issue