BUGFIX: pressing '?' will now always open the keyboard shortcut modal

This commit is contained in:
Régis Hanol 2014-01-06 16:43:36 +01:00
parent da6af9024d
commit ec10575a9e
1 changed files with 8 additions and 4 deletions

View File

@ -13,7 +13,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
'g u': '/unread',
'g f': '/favorited',
'g c': '/categories',
'g t': '/top',
'g t': '/top'
},
CLICK_BINDINGS: {
@ -37,8 +37,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
's': '#topic-footer-buttons button.share', // share topic
'S': 'article.selected button.share', // share selected post
'/': '#search-button', // focus search
'!': 'article.selected button.flag', // flag selected post
'?': '#keyboard-help' // open keyboard shortcut help
'!': 'article.selected button.flag' // flag selected post
},
FUNCTION_BINDINGS: {
@ -46,7 +45,8 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
'k': 'selectUp',
'u': 'goBack',
'`': 'nextSection',
'~': 'prevSection'
'~': 'prevSection',
'?': 'showHelpModal' // open keyboard shortcut help
},
bindEvents: function(keyTrapper) {
@ -76,6 +76,10 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
this._changeSection(-1);
},
showHelpModal: function() {
Discourse.__container__.lookup('controller:application').send("showKeyboardShortcutsHelp");
},
_bindToPath: function(path, binding) {
this.keyTrapper.bind(binding, function() {
Discourse.URL.routeTo(path);