FEATURE: add 'change ownership' button in post admin wrench

This commit is contained in:
Arpit Jalan 2015-10-11 23:18:08 +05:30
parent 43cd0912e6
commit b72434d024
5 changed files with 19 additions and 2 deletions

View file

@ -364,7 +364,9 @@ const PostMenuComponent = Ember.Component.extend(StringBuffer, {
rebakePostIcon = iconHTML('cog'),
rebakePostText = I18n.t('post.controls.rebake'),
unhidePostIcon = iconHTML('eye'),
unhidePostText = I18n.t('post.controls.unhide');
unhidePostText = I18n.t('post.controls.unhide'),
changePostOwnerIcon = iconHTML('user'),
changePostOwnerText = I18n.t('post.controls.change_owner');
const html = '<div class="post-admin-menu popup-menu">' +
'<h3>' + I18n.t('admin_title') + '</h3>' +
@ -373,6 +375,7 @@ const PostMenuComponent = Ember.Component.extend(StringBuffer, {
(Discourse.User.currentProp('staff') ? '<li class="btn" data-action="togglePostType">' + postTypeIcon + postTypeText + '</li>' : '') +
'<li class="btn" data-action="rebakePost">' + rebakePostIcon + rebakePostText + '</li>' +
(post.hidden ? '<li class="btn" data-action="unhidePost">' + unhidePostIcon + unhidePostText + '</li>' : '') +
(Discourse.User.currentProp('admin') ? '<li class="btn" data-action="changePostOwner">' + changePostOwnerIcon + changePostOwnerText + '</li>' : '') +
'</ul>' +
'</div>';
@ -404,6 +407,10 @@ const PostMenuComponent = Ember.Component.extend(StringBuffer, {
this.sendAction("unhidePost", this.get("post"));
},
clickChangePostOwner() {
this.sendAction("changePostOwner", this.get("post"));
},
buttonForShowMoreActions() {
return new Button('showMoreActions', 'show_more', 'ellipsis-h');
},

View file

@ -42,7 +42,10 @@ export default Ember.Controller.extend(SelectedPostsCount, ModalFunctionality, {
Discourse.Topic.changeOwners(this.get('topicController.model.id'), saveOpts).then(function() {
// success
self.send('closeModal');
self.get('topicController').send('toggleMultiSelect');
self.get('topicController').send('deselectAll');
if (self.get('topicController.multiSelect')) {
self.get('topicController').send('toggleMultiSelect');
}
Em.run.next(() => { DiscourseURL.routeTo(self.get("topicController.model.url")); });
}, function() {
// failure

View file

@ -442,6 +442,11 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
unhidePost(post) {
post.unhide();
},
changePostOwner(post) {
this.get('selectedPosts').addObject(post);
this.send('changeOwner');
}
},

View file

@ -110,6 +110,7 @@
togglePostType="togglePostType"
rebakePost="rebakePost"
unhidePost="unhidePost"
changePostOwner="changePostOwner"
toggleWhoLiked="toggleWhoLiked"
toggleWhoLikedTarget=view}}
</div>

View file

@ -1420,6 +1420,7 @@ en:
revert_to_regular: "Remove Staff Color"
rebake: "Rebuild HTML"
unhide: "Unhide"
change_owner: "Change Ownership"
actions:
flag: 'Flag'