use shift-[1-0] to switch between item views, fixes #2837

This commit is contained in:
j 2015-10-13 09:10:48 +01:00
parent d16bbf6ba8
commit cc9464082f

View file

@ -4,6 +4,7 @@
pandora.ui.mainMenu = function() { pandora.ui.mainMenu = function() {
var isGuest = pandora.user.level == 'guest', var isGuest = pandora.user.level == 'guest',
itemViewKey = 1,
ui = pandora.user.ui, ui = pandora.user.ui,
findState = pandora.getFindState(ui.find), findState = pandora.getFindState(ui.find),
fromMenu = false, fromMenu = false,
@ -113,6 +114,9 @@ pandora.ui.mainMenu = function() {
return Ox.extend({ return Ox.extend({
checked: ui.itemView == view.id checked: ui.itemView == view.id
}, view, { }, view, {
keyboard: itemViewKey <= 10
? 'shift ' + (itemViewKey++%10)
: void 0,
title: Ox._(view.title) title: Ox._(view.title)
}); });
}) }, }) },
@ -861,6 +865,14 @@ pandora.ui.mainMenu = function() {
} }
}); });
pandora.site.itemViews.forEach(function(view, i) {
if (i < 10) {
Ox.Event.bind('key_shift_' + (i + 1) % 10, function() {
pandora.UI.set({itemView: view.id});
});
}
});
pandora.clipboard.bindEvent(function(data, event) { pandora.clipboard.bindEvent(function(data, event) {
if (Ox.contains(['add', 'copy', 'clear'], event)) { if (Ox.contains(['add', 'copy', 'clear'], event)) {
that.replaceMenu('itemMenu', getItemMenu()); that.replaceMenu('itemMenu', getItemMenu());