mirror of
http://git.whoc.org.uk/git/password-manager.git
synced 2025-10-29 18:37:35 +01:00
Added keyboard cheat sheet
This commit is contained in:
102
frontend/delta/js/Clipperz/PM/UI/Components/Help.js
Normal file
102
frontend/delta/js/Clipperz/PM/UI/Components/Help.js
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
|
||||
Copyright 2008-2015 Clipperz Srl
|
||||
|
||||
This file is part of Clipperz, the online password manager.
|
||||
For further information about its features and functionalities please
|
||||
refer to http://www.clipperz.com.
|
||||
|
||||
* Clipperz is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
* Clipperz is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
See the GNU Affero General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
License along with Clipperz. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
Clipperz.Base.module('Clipperz.PM.UI.Components');
|
||||
|
||||
Clipperz.PM.UI.Components.HelpClass = React.createClass({
|
||||
|
||||
close: function (anEvent) {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'closeHelp');
|
||||
},
|
||||
|
||||
//=========================================================================
|
||||
|
||||
render: function () {
|
||||
return React.DOM.div({'className':'help', 'key':'help'}, [
|
||||
React.DOM.div({'className':'helpBox'}, [
|
||||
React.DOM.header({}, [
|
||||
React.DOM.h3({}, "Keyboard shortcuts"),
|
||||
React.DOM.div({'className':'button close', 'onClick':this.close}, "close")
|
||||
]),
|
||||
React.DOM.div({'className':'helpContent'}, [
|
||||
React.DOM.div({'className':'helpBlock'}, [
|
||||
React.DOM.h4({}, "Search"),
|
||||
React.DOM.dl({}, [
|
||||
React.DOM.dt({}, [
|
||||
React.DOM.span({'className':'key'}, '/')
|
||||
]), React.DOM.dd({}, "search cards"),
|
||||
React.DOM.dt({}, [
|
||||
React.DOM.span({'className':'key'}, '*'),
|
||||
React.DOM.span({'className':'operator'}, 'then'),
|
||||
React.DOM.span({'className':'key'}, 'a'),
|
||||
]), React.DOM.dd({}, "select all cards"),
|
||||
])
|
||||
]),
|
||||
React.DOM.div({'className':'helpBlock'}, [
|
||||
React.DOM.h4({}, "Navigation"),
|
||||
React.DOM.dl({}, [
|
||||
React.DOM.dt({}, [
|
||||
React.DOM.span({'className':'key'}, 'h'),
|
||||
React.DOM.span({'className':'operator'}, 'or'),
|
||||
React.DOM.span({'className':'key'}, '<left>'),
|
||||
React.DOM.span({'className':'operator'}, 'or'),
|
||||
React.DOM.span({'className':'key'}, '<esc>'),
|
||||
]), React.DOM.dd({}, "exit current selection"),
|
||||
React.DOM.dt({}, [
|
||||
React.DOM.span({'className':'key'}, 'l'),
|
||||
React.DOM.span({'className':'operator'}, 'or'),
|
||||
React.DOM.span({'className':'key'}, '<right>'),
|
||||
React.DOM.span({'className':'operator'}, 'or'),
|
||||
React.DOM.span({'className':'key'}, '<enter>'),
|
||||
]), React.DOM.dd({}, "select detail"),
|
||||
React.DOM.dt({}, [
|
||||
React.DOM.span({'className':'key'}, 'k'),
|
||||
React.DOM.span({'className':'operator'}, '/'),
|
||||
React.DOM.span({'className':'key'}, 'j'),
|
||||
]), React.DOM.dd({}, "previous/next card"),
|
||||
])
|
||||
]),
|
||||
/*
|
||||
|
||||
Mousetrap.bind(['left', 'h', 'esc'], MochiKit.Base.method(this, 'exitCurrentSelection'));
|
||||
Mousetrap.bind(['right', 'l', 'enter'], MochiKit.Base.method(this, 'selectDetail'));
|
||||
|
||||
Mousetrap.bind(['up', 'k'], MochiKit.Base.method(this, 'selectPreviousCard'));
|
||||
Mousetrap.bind(['down', 'j'], MochiKit.Base.method(this, 'selectNextCard'));
|
||||
|
||||
|
||||
Mousetrap.bind(['/'], MochiKit.Base.method(this, 'focusOnSearch'));
|
||||
Mousetrap.bind(['* a'], MochiKit.Base.method(this, 'selectAllCards_handler'));
|
||||
|
||||
Mousetrap.bind(['?'], MochiKit.Base.method(this, 'showHelp_handler'));
|
||||
*/
|
||||
])
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
//=========================================================================
|
||||
});
|
||||
|
||||
Clipperz.PM.UI.Components.Help = React.createFactory(Clipperz.PM.UI.Components.HelpClass);
|
||||
@@ -184,7 +184,7 @@ Clipperz.PM.UI.Components.Panels.MainPanelClass = React.createClass({
|
||||
},
|
||||
|
||||
render: function () {
|
||||
//console.log("MainPanel.render", this.props['showGlobalMask']);
|
||||
//console.log("MainPanel.render", this.props['showHelp']);
|
||||
var classes = {
|
||||
'panel': true,
|
||||
'left': this.props['selectionPanelStatus'] == 'OPEN',
|
||||
@@ -193,9 +193,10 @@ Clipperz.PM.UI.Components.Panels.MainPanelClass = React.createClass({
|
||||
};
|
||||
classes[this.style()] = true;
|
||||
|
||||
return React.DOM.div({'key':'mainPanel', 'id':'mainPanel', 'className':Clipperz.PM.UI.Components.classNames(classes)}, [
|
||||
React.DOM.div({'className':'mask', 'onClick':this.handleMaskClick, 'onTouchEnd':this.handleMaskClick}),
|
||||
React.DOM.div({'className':'container'},
|
||||
return React.DOM.div({'id':'mainPanel', 'className':Clipperz.PM.UI.Components.classNames(classes), 'key':'mainPanel'}, [
|
||||
React.DOM.div({'className':'mask', 'onClick':this.handleMaskClick, 'onTouchEnd':this.handleMaskClick, 'key':'mask'}),
|
||||
this.props['showHelp'] ? Clipperz.PM.UI.Components.Help(this.props) : null,
|
||||
React.DOM.div({'className':'container', 'key':'container'},
|
||||
// this.style() == 'extra-wide' ? this.renderExtraWide() : this.renderOther()
|
||||
this.renderLayout(this.style())
|
||||
)
|
||||
|
||||
@@ -81,6 +81,7 @@ Clipperz.PM.UI.MainController = function() {
|
||||
'showArchivedCards', 'hideArchivedCards',
|
||||
'goBackToMainPage',
|
||||
'maskClick',
|
||||
'closeHelp',
|
||||
'downloadOfflineCopy',
|
||||
'runDirectLogin',
|
||||
'exitSearch'
|
||||
@@ -96,6 +97,8 @@ Clipperz.PM.UI.MainController = function() {
|
||||
|
||||
Mousetrap.bind(['* a'], MochiKit.Base.method(this, 'selectAllCards_handler'));
|
||||
|
||||
Mousetrap.bind(['?'], MochiKit.Base.method(this, 'showHelp_handler'));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1670,6 +1673,7 @@ console.log("THE BROWSER IS OFFLINE");
|
||||
//============================================================================
|
||||
|
||||
selectAllCards_handler: function () {
|
||||
this.setPageProperties('mainPage', 'searchTerm', '');
|
||||
this.resetSelectedCard();
|
||||
this.setFilter('ALL');
|
||||
return this.refreshSelectedCards();
|
||||
@@ -1729,6 +1733,22 @@ console.log("THE BROWSER IS OFFLINE");
|
||||
this._closeMaskAction = null;
|
||||
},
|
||||
|
||||
//............................................................................
|
||||
|
||||
showHelp_handler: function () {
|
||||
if (this.currentPage() == 'mainPage') {
|
||||
this.setPageProperties(this.currentPage(), 'showHelp', true);
|
||||
}
|
||||
},
|
||||
|
||||
closeHelp_handler: function () {
|
||||
this.setPageProperties(this.currentPage(), 'showHelp', false);
|
||||
},
|
||||
|
||||
isShowingHelp: function () {
|
||||
return this.pages()[this.currentPage()].props['showHelp'];
|
||||
},
|
||||
|
||||
//============================================================================
|
||||
|
||||
matchMediaQuery_handler: function (newQueryStyle) {
|
||||
@@ -1837,10 +1857,14 @@ console.log("THE BROWSER IS OFFLINE");
|
||||
},
|
||||
|
||||
exitCurrentSelection: function () {
|
||||
if (this.currentPage() == 'cardDetailPage') {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'goBackToMainPage', {'reference':this.selectedCardInfo()['reference']});
|
||||
} else if (this.currentPage() == 'mainPage') {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectCard', null, true);
|
||||
if (this.isShowingHelp()) {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'closeHelp');
|
||||
} else {
|
||||
if (this.currentPage() == 'cardDetailPage') {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'goBackToMainPage', {'reference':this.selectedCardInfo()['reference']});
|
||||
} else if (this.currentPage() == 'mainPage') {
|
||||
MochiKit.Signal.signal(Clipperz.Signal.NotificationCenter, 'selectCard', null, true);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user