Keyboard shortcut legend

New: Show keybaord shortcuts with '?'
New: ctrl+s will save settings
This commit is contained in:
Mark McDowall
2014-07-29 00:10:07 -07:00
parent 7fc3b971f6
commit e71de9cc29
10 changed files with 141 additions and 14 deletions
+37
View File
@@ -0,0 +1,37 @@
'use strict';
define(
[
'jquery',
'vent',
'Hotkeys/HotkeysView'
], function ($, vent, HotkeysView) {
$(document).on('keydown', function (e) {
if (e.ctrlKey && e.keyCode === 83) {
vent.trigger(vent.Hotkeys.SaveSettings);
e.preventDefault();
return;
}
if (e.shiftKey && e.keyCode === 191) {
vent.trigger(vent.Commands.OpenModalCommand, new HotkeysView());
// vent.trigger(vent.Hotkeys.ShowHotkeys);
e.preventDefault();
return;
}
if ($(e.target).is('input') || $(e.target).is('textarea')) {
return;
}
if (e.ctrlKey || e.metaKey || e.altKey) {
return;
}
if (e.keyCode === 84) {
vent.trigger(vent.Hotkeys.NavbarSearch);
e.preventDefault();
}
});
});
+11
View File
@@ -0,0 +1,11 @@
'use strict';
define(
[
'vent',
'marionette'
], function (vent, Marionette) {
return Marionette.ItemView.extend({
template: 'Hotkeys/HotkeysViewTemplate'
});
});
+47
View File
@@ -0,0 +1,47 @@
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h3>Keyboard Shortcuts</h3>
</div>
<div class="modal-body hotkeys-modal">
<div class="row hotkey-group">
<div class="col-md-12">
<div class="row">
<div class="col-md-5 col-md-offset-1">
<h3>Focus Search Box</h3>
</div>
<div class="col-md-3">
<kbd class="hotkey">t</kbd>
</div>
</div>
<div class="row">
<div class="col-md-11 col-md-offset-1">
Pressing 't' puts the cursor in the search box below the navigation links
</div>
</div>
</div>
</div>
<div class="row hotkey-group">
<div class="col-md-12">
<div class="row">
<div class="col-md-5 col-md-offset-1">
<h3>Save Settings</h3>
</div>
<div class="col-md-3">
<kbd class="hotkey">ctrl + s</kbd>
</div>
</div>
<div class="row">
<div class="col-md-11 col-md-offset-1">
Pressing ctrl + 's' saves your settings (only in settings)
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal">close</button>
</div>
</div>
</div>
+23
View File
@@ -0,0 +1,23 @@
.hotkeys-modal {
h3 {
margin-top : 0px;
margin-botton : 0px;
}
.hotkey-group {
&:first-of-type {
margin-top : 0px;
}
&:last-of-type {
margin-bottom : 0px;
}
margin-top : 25px;
margin-bottom : 25px;
.hotkey {
font-size : 22px;
}
}
}