mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 04:13:22 +08:00
FEATURE: Added Pin/Unpin Keyboard Shortcut
This commit is contained in:
parent
a036ac7bdc
commit
61cc8ead44
|
@ -369,6 +369,11 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
|||
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) {
|
||||
var composerController = this.get('controllers.composer'),
|
||||
quoteController = this.get('controllers.quote-button'),
|
||||
|
@ -437,6 +442,10 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
|||
}
|
||||
},
|
||||
|
||||
togglePinnedState: function() {
|
||||
this.send('togglePinnedForUser');
|
||||
},
|
||||
|
||||
showExpandButton: function() {
|
||||
var post = this.get('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',
|
||||
'j': 'selectDown',
|
||||
'shift+k': 'prevSection',
|
||||
'shift+p': 'pinUnpinTopic',
|
||||
'k': 'selectUp',
|
||||
'u': 'goBack',
|
||||
'/': '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});
|
||||
},
|
||||
|
||||
pinUnpinTopic: function() {
|
||||
Discourse.__container__lookup('controller:topic').togglePinnedState();
|
||||
},
|
||||
|
||||
toggleProgress: function() {
|
||||
Discourse.__container__.lookup('controller:topic-progress').send('toggleExpansion', {highlight: true});
|
||||
},
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
<h4>{{i18n keyboard_shortcuts_help.actions.title}}</h4>
|
||||
<ul>
|
||||
<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_post}}}</li>
|
||||
<li>{{{i18n keyboard_shortcuts_help.actions.reply_as_new_topic}}}</li>
|
||||
|
|
|
@ -2189,6 +2189,7 @@ en:
|
|||
actions:
|
||||
title: 'Actions'
|
||||
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_post: '<b>s</b> Share post'
|
||||
reply_as_new_topic: '<b>t</b> Reply as linked topic'
|
||||
|
|
Loading…
Reference in New Issue
Block a user