fix keyboard shortcut to switch document views
This commit is contained in:
parent
cc00510f5d
commit
03b5937a4d
1 changed files with 36 additions and 9 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
pandora.ui.mainMenu = function() {
|
pandora.ui.mainMenu = function() {
|
||||||
var isGuest = pandora.user.level == 'guest',
|
var isGuest = pandora.user.level == 'guest',
|
||||||
|
documentViewKey = 1,
|
||||||
itemViewKey = 1,
|
itemViewKey = 1,
|
||||||
listViewKey = 1,
|
listViewKey = 1,
|
||||||
ui = pandora.user.ui,
|
ui = pandora.user.ui,
|
||||||
|
@ -134,6 +135,18 @@ pandora.ui.mainMenu = function() {
|
||||||
return {id: view, title: Ox._(Ox.toTitleCase(view)), checked: ui.videoView == view};
|
return {id: view, title: Ox._(Ox.toTitleCase(view)), checked: ui.videoView == view};
|
||||||
}) }
|
}) }
|
||||||
] },
|
] },
|
||||||
|
{ id: 'documents', title: Ox._('Open Documents'), items: [
|
||||||
|
{ group: 'documentview', min: 1, max: 1, items: ['info', 'view'].map(function(id) {
|
||||||
|
return {
|
||||||
|
id: id,
|
||||||
|
checked: ui.documentView == id,
|
||||||
|
keyboard: documentViewKey <= 10
|
||||||
|
? 'shift ' + (documentViewKey++%10)
|
||||||
|
: void 0,
|
||||||
|
title: Ox._(Ox.toTitleCase(id))
|
||||||
|
}
|
||||||
|
}) }
|
||||||
|
] },
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
id: 'showsidebar',
|
id: 'showsidebar',
|
||||||
|
@ -306,6 +319,8 @@ pandora.ui.mainMenu = function() {
|
||||||
set.listSort = pandora.site.user.ui.listSort;
|
set.listSort = pandora.site.user.ui.listSort;
|
||||||
}
|
}
|
||||||
pandora.UI.set(set);
|
pandora.UI.set(set);
|
||||||
|
} else if (data.id == 'documentview') {
|
||||||
|
pandora.UI.set({documentView: value});
|
||||||
} else if (Ox.startsWith(data.id, 'orderfilter')) {
|
} else if (Ox.startsWith(data.id, 'orderfilter')) {
|
||||||
var filters = Ox.clone(ui.filters),
|
var filters = Ox.clone(ui.filters),
|
||||||
id = data.id.replace('orderfilter', ''),
|
id = data.id.replace('orderfilter', ''),
|
||||||
|
@ -979,16 +994,28 @@ pandora.ui.mainMenu = function() {
|
||||||
Ox.range(10).forEach(function(i) {
|
Ox.range(10).forEach(function(i) {
|
||||||
Ox.Event.bind('key_shift_' + (i + 1) % 10, function() {
|
Ox.Event.bind('key_shift_' + (i + 1) % 10, function() {
|
||||||
var view;
|
var view;
|
||||||
if (ui.item) {
|
if (ui.section == 'items') {
|
||||||
view = pandora.site.itemViews[i];
|
if (ui.item) {
|
||||||
if (view && (view.id != 'data' && view.id != 'media' ||
|
view = pandora.site.itemViews[i];
|
||||||
pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level])) {
|
if (view && (view.id != 'data' && view.id != 'media' ||
|
||||||
pandora.UI.set({itemView: view.id});
|
pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level])) {
|
||||||
|
pandora.UI.set({itemView: view.id});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
view = pandora.site.listViews[i];
|
||||||
|
if (view) {
|
||||||
|
pandora.UI.set({listView: view.id});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else if (ui.section == 'edits') {
|
||||||
view = pandora.site.listViews[i];
|
if (ui.edit && i < 3) {
|
||||||
if (view) {
|
pandora.UI.set({editView: ['list', 'grid', 'annotations'][i]});
|
||||||
pandora.UI.set({listView: view.id});
|
}
|
||||||
|
} else if (ui.section == 'documents') {
|
||||||
|
if (ui.document && i < 2) {
|
||||||
|
pandora.UI.set({documentView: ['info', 'view'][i]});
|
||||||
|
} else if (i < 2) {
|
||||||
|
pandora.UI.set({collectionView: ['list', 'grid'][i]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue