Keyboard shortcut legend

New: Show keybaord shortcuts with '?'
New: ctrl+s will save settings
pull/4/head
Mark McDowall 10 years ago
parent 7fc3b971f6
commit e71de9cc29

@ -7,6 +7,7 @@ define(
Events: {
ConfigUpdatedEvent: 'ConfigUpdatedEvent'
},
Keys : {
DefaultProfileId : 'DefaultProfileId',
DefaultRootFolderId : 'DefaultRootFolderId',

@ -16,6 +16,7 @@
@import "../Rename/rename";
@import "typeahead";
@import "utilities";
@import "../Hotkeys/hotkeys";
.main-region {
@media (min-width: @screen-lg-min) {
@ -239,3 +240,10 @@ body {
padding-top: 10px;
}
}
.modal-header {
h3 {
margin-top : 0px;
margin-bottom : 0px;
}
}

@ -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();
}
});
});

@ -0,0 +1,11 @@
'use strict';
define(
[
'vent',
'marionette'
], function (vent, Marionette) {
return Marionette.ItemView.extend({
template: 'Hotkeys/HotkeysViewTemplate'
});
});

@ -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>

@ -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;
}
}
}

@ -3,23 +3,14 @@ define(
[
'underscore',
'jquery',
'vent',
'backbone',
'Series/SeriesCollection',
'typeahead'
], function (_, $, Backbone, SeriesCollection) {
$(document).on('keydown', function (e) {
if ($(e.target).is('input') || $(e.target).is('textarea')) {
return;
}
], function (_, $, vent, Backbone, SeriesCollection) {
if (e.ctrlKey || e.metaKey || e.altKey) {
return;
}
if (e.keyCode === 84) {
$('.x-series-search').focus();
e.preventDefault();
}
vent.on(vent.Hotkeys.NavbarSearch, function () {
$('.x-series-search').focus();
});
$.fn.bindSearch = function () {

@ -89,6 +89,8 @@ define(
if (options.action) {
this.action = options.action.toLowerCase();
}
this.listenTo(vent, vent.Hotkeys.SaveSettings, this._save);
},
onRender: function () {

@ -245,7 +245,8 @@ define(
'System/StatusModel',
'Shared/Tooltip',
'Instrumentation/StringFormat',
'LifeCycle'
'LifeCycle',
'Hotkeys/Hotkeys'
], function ($, Backbone, Marionette, RouteBinder, SignalRBroadcaster, NavbarView, AppLayout, SeriesController, Router, ModalController, ControlPanelController, serverStatusModel, Tooltip) {
new SeriesController();

@ -30,5 +30,11 @@ define(
CloseControlPanelCommand : 'CloseControlPanelCommand'
};
vent.Hotkeys = {
NavbarSearch : 'navbar:search',
SaveSettings : 'settings:save',
ShowHotkeys : 'hotkeys:show'
};
return vent;
});

Loading…
Cancel
Save