Keyboard shortcuts for new progress expansion
This commit is contained in:
parent
42ca46e628
commit
cf165320e2
|
@ -44,6 +44,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||
|
||||
FUNCTION_BINDINGS: {
|
||||
'home': 'goToFirstPost',
|
||||
'#': 'toggleProgress',
|
||||
'end': 'goToLastPost',
|
||||
'j': 'selectDown',
|
||||
'k': 'selectUp',
|
||||
|
@ -132,6 +133,10 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||
}
|
||||
},
|
||||
|
||||
toggleProgress: function() {
|
||||
Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion');
|
||||
},
|
||||
|
||||
showSearch: function() {
|
||||
$('#search-button').click();
|
||||
return false;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<h4>{{i18n keyboard_shortcuts_help.navigation.title}}</h4>
|
||||
<ul>
|
||||
<li>{{{i18n keyboard_shortcuts_help.navigation.back}}}</li>
|
||||
<li>{{{i18n keyboard_shortcuts_help.navigation.jump}}}</li>
|
||||
<li>{{{i18n keyboard_shortcuts_help.navigation.up_down}}}</li>
|
||||
<li>{{{i18n keyboard_shortcuts_help.navigation.open}}}</li>
|
||||
<li>{{{i18n keyboard_shortcuts_help.navigation.next_prev}}}</li>
|
||||
|
|
|
@ -76,10 +76,30 @@ export default Ember.View.extend({
|
|||
this.set('docked', isDocked);
|
||||
},
|
||||
|
||||
_focusWhenOpened: function() {
|
||||
if (this.get('controller.expanded')) {
|
||||
var self = this;
|
||||
Em.run.schedule('afterRender', function() {
|
||||
self.$('input').focus();
|
||||
});
|
||||
}
|
||||
}.observes('controller.expanded'),
|
||||
|
||||
click: function(e) {
|
||||
if ($(e.target).parents('#topic-progress').length) {
|
||||
this.get('controller').send('toggleExpansion');
|
||||
}
|
||||
},
|
||||
|
||||
keyDown: function(e) {
|
||||
var controller = this.get('controller');
|
||||
if (controller.get('expanded')) {
|
||||
if (e.keyCode === 13) {
|
||||
controller.send('jumpPost');
|
||||
} else if (e.keyCode === 27) {
|
||||
controller.send('toggleExpansion');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
}
|
||||
|
||||
.keyboard-shortcuts-modal .modal-body {
|
||||
max-height: 500px;
|
||||
max-height: 520px;
|
||||
}
|
||||
|
||||
#keyboard-shortcuts-help {
|
||||
|
|
|
@ -1850,6 +1850,7 @@ en:
|
|||
categories: '<b>g</b> then <b>c</b> Categories'
|
||||
navigation:
|
||||
title: 'Navigation'
|
||||
jump: '<b>#</b> Go to post number'
|
||||
back: '<b>u</b> Back'
|
||||
up_down: '<b>k</b>/<b>j</b> Move selection up/down'
|
||||
open: '<b>o</b> or <b>Enter</b> Open selected topic'
|
||||
|
|
Loading…
Reference in New Issue