FEATURE: HOME/END should always take you to the correct spot

This commit is contained in:
Régis Hanol 2014-02-04 23:25:27 +01:00
parent 8adb08a9ca
commit 759c18d9f5

View File

@ -41,6 +41,8 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
},
FUNCTION_BINDINGS: {
'home': 'goToFirstPost',
'end': 'goToLastPost',
'j': 'selectDown',
'k': 'selectUp',
'u': 'goBack',
@ -56,6 +58,14 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
_.each(this.FUNCTION_BINDINGS, this._bindToFunction, this);
},
goToFirstPost: function() {
Discourse.__container__.lookup('controller:topic').send('jumpTop');
},
goToLastPost: function() {
Discourse.__container__.lookup('controller:topic').send('jumpBottom');
},
selectDown: function() {
this._moveSelection(1);
},
@ -77,7 +87,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
},
showHelpModal: function() {
Discourse.__container__.lookup('controller:application').send("showKeyboardShortcutsHelp");
Discourse.__container__.lookup('controller:application').send('showKeyboardShortcutsHelp');
},
_bindToPath: function(path, binding) {