Merge pull request #2231 from arunisrael/fix_search_key_shortcut

[bugfix] Fix for '/' keyboard shortcut putting '/' into search input
This commit is contained in:
Sam 2014-04-07 06:22:00 +10:00
commit af6e376ee3
1 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,6 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
'R': 'article.selected button.create', // reply to selected post 'R': 'article.selected button.create', // reply to selected post
's': '#topic-footer-buttons button.share', // share topic 's': '#topic-footer-buttons button.share', // share topic
'S': 'article.selected button.share', // share selected post 'S': 'article.selected button.share', // share selected post
'/': '#search-button', // focus search
'!': 'article.selected button.flag' // flag selected post '!': 'article.selected button.flag' // flag selected post
}, },
@ -48,6 +47,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
'u': 'goBack', 'u': 'goBack',
'`': 'nextSection', '`': 'nextSection',
'~': 'prevSection', '~': 'prevSection',
'/': 'showSearch',
'?': 'showHelpModal' // open keyboard shortcut help '?': 'showHelpModal' // open keyboard shortcut help
}, },
@ -92,6 +92,11 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
this._changeSection(-1); this._changeSection(-1);
}, },
showSearch: function() {
$('#search-button').click();
return false;
},
showHelpModal: function() { showHelpModal: function() {
Discourse.__container__.lookup('controller:application').send('showKeyboardShortcutsHelp'); Discourse.__container__.lookup('controller:application').send('showKeyboardShortcutsHelp');
}, },