Merge pull request #2912 from cpradio/pr-make-create-topic-global

FIX: Make shortcut 'c' global for creating a topic
This commit is contained in:
Sam 2014-10-30 17:23:12 +11:00
commit 75ffb0a425
1 changed files with 5 additions and 2 deletions

View File

@ -27,8 +27,6 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
},
CLICK_BINDINGS: {
'c': '#create-topic', // create new topic
// star topic
'f': '#topic-footer-buttons button.star, .topic-list tr.topic-list-item.selected a.star',
@ -47,6 +45,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
},
FUNCTION_BINDINGS: {
'c': 'createTopic', // create new topic
'home': 'goToFirstPost',
'#': 'toggleProgress',
'end': 'goToLastPost',
@ -131,6 +130,10 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
return showSearch ? this.showSearch(true) : true;
},
createTopic: function() {
Discourse.__container__.lookup('controller:composer').open({action: Discourse.Composer.CREATE_TOPIC, draftKey: Discourse.Composer.DRAFT});
},
toggleProgress: function() {
Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion', {highlight: true});
},