Merge pull request #2963 from cpradio/pr-pin-unpin-topic-kb-shortcut
FEATURE: Added Pin/Unpin Keyboard Shortcut
This commit is contained in:
commit
3829add90b
|
@ -369,6 +369,11 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
||||||
this.get('content').clearPin();
|
this.get('content').clearPin();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
togglePinnedForUser: function() {
|
||||||
|
if (this.get('pinned_at'))
|
||||||
|
this.get('pinned') ? this.get('content').clearPin() : this.get('content').rePin();
|
||||||
|
},
|
||||||
|
|
||||||
replyAsNewTopic: function(post) {
|
replyAsNewTopic: function(post) {
|
||||||
var composerController = this.get('controllers.composer'),
|
var composerController = this.get('controllers.composer'),
|
||||||
quoteController = this.get('controllers.quote-button'),
|
quoteController = this.get('controllers.quote-button'),
|
||||||
|
@ -437,6 +442,10 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
togglePinnedState: function() {
|
||||||
|
this.send('togglePinnedForUser');
|
||||||
|
},
|
||||||
|
|
||||||
showExpandButton: function() {
|
showExpandButton: function() {
|
||||||
var post = this.get('post');
|
var post = this.get('post');
|
||||||
return post.get('post_number') === 1 && post.get('topic.expandable_first_post');
|
return post.get('post_number') === 1 && post.get('topic.expandable_first_post');
|
||||||
|
|
|
@ -52,6 +52,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
||||||
'shift+j': 'nextSection',
|
'shift+j': 'nextSection',
|
||||||
'j': 'selectDown',
|
'j': 'selectDown',
|
||||||
'shift+k': 'prevSection',
|
'shift+k': 'prevSection',
|
||||||
|
'shift+p': 'pinUnpinTopic',
|
||||||
'k': 'selectUp',
|
'k': 'selectUp',
|
||||||
'u': 'goBack',
|
'u': 'goBack',
|
||||||
'/': 'showSearch',
|
'/': 'showSearch',
|
||||||
|
@ -134,6 +135,10 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
||||||
Discourse.__container__.lookup('controller:composer').open({action: Discourse.Composer.CREATE_TOPIC, draftKey: Discourse.Composer.DRAFT});
|
Discourse.__container__.lookup('controller:composer').open({action: Discourse.Composer.CREATE_TOPIC, draftKey: Discourse.Composer.DRAFT});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
pinUnpinTopic: function() {
|
||||||
|
Discourse.__container__.lookup('controller:topic').togglePinnedState();
|
||||||
|
},
|
||||||
|
|
||||||
toggleProgress: function() {
|
toggleProgress: function() {
|
||||||
Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion', {highlight: true});
|
Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion', {highlight: true});
|
||||||
},
|
},
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
<h4>{{i18n keyboard_shortcuts_help.actions.title}}</h4>
|
<h4>{{i18n keyboard_shortcuts_help.actions.title}}</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>{{{i18n keyboard_shortcuts_help.actions.star}}}</li>
|
<li>{{{i18n keyboard_shortcuts_help.actions.star}}}</li>
|
||||||
|
<li>{{{i18n keyboard_shortcuts_help.actions.pin_unpin_topic}}}</li>
|
||||||
<li>{{{i18n keyboard_shortcuts_help.actions.share_topic}}}</li>
|
<li>{{{i18n keyboard_shortcuts_help.actions.share_topic}}}</li>
|
||||||
<li>{{{i18n keyboard_shortcuts_help.actions.share_post}}}</li>
|
<li>{{{i18n keyboard_shortcuts_help.actions.share_post}}}</li>
|
||||||
<li>{{{i18n keyboard_shortcuts_help.actions.reply_as_new_topic}}}</li>
|
<li>{{{i18n keyboard_shortcuts_help.actions.reply_as_new_topic}}}</li>
|
||||||
|
|
|
@ -2189,6 +2189,7 @@ en:
|
||||||
actions:
|
actions:
|
||||||
title: 'Actions'
|
title: 'Actions'
|
||||||
star: '<b>f</b> Star topic'
|
star: '<b>f</b> Star topic'
|
||||||
|
pin_unpin_topic: '<b>shift p</b> Pin/Unpin topic'
|
||||||
share_topic: '<b>shift s</b> Share topic'
|
share_topic: '<b>shift s</b> Share topic'
|
||||||
share_post: '<b>s</b> Share post'
|
share_post: '<b>s</b> Share post'
|
||||||
reply_as_new_topic: '<b>t</b> Reply as linked topic'
|
reply_as_new_topic: '<b>t</b> Reply as linked topic'
|
||||||
|
|
Loading…
Reference in New Issue