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'), rebakePostIcon = iconHTML('cog'),
rebakePostText = I18n.t('post.controls.rebake'), rebakePostText = I18n.t('post.controls.rebake'),
unhidePostIcon = iconHTML('eye'), 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">' + const html = '<div class="post-admin-menu popup-menu">' +
'<h3>' + I18n.t('admin_title') + '</h3>' + '<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>' : '') + (Discourse.User.currentProp('staff') ? '<li class="btn" data-action="togglePostType">' + postTypeIcon + postTypeText + '</li>' : '') +
'<li class="btn" data-action="rebakePost">' + rebakePostIcon + rebakePostText + '</li>' + '<li class="btn" data-action="rebakePost">' + rebakePostIcon + rebakePostText + '</li>' +
(post.hidden ? '<li class="btn" data-action="unhidePost">' + unhidePostIcon + unhidePostText + '</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>' + '</ul>' +
'</div>'; '</div>';
@ -404,6 +407,10 @@ const PostMenuComponent = Ember.Component.extend(StringBuffer, {
this.sendAction("unhidePost", this.get("post")); this.sendAction("unhidePost", this.get("post"));
}, },
clickChangePostOwner() {
this.sendAction("changePostOwner", this.get("post"));
},
buttonForShowMoreActions() { buttonForShowMoreActions() {
return new Button('showMoreActions', 'show_more', 'ellipsis-h'); 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() { Discourse.Topic.changeOwners(this.get('topicController.model.id'), saveOpts).then(function() {
// success // success
self.send('closeModal'); self.send('closeModal');
self.get('topicController').send('deselectAll');
if (self.get('topicController.multiSelect')) {
self.get('topicController').send('toggleMultiSelect'); self.get('topicController').send('toggleMultiSelect');
}
Em.run.next(() => { DiscourseURL.routeTo(self.get("topicController.model.url")); }); Em.run.next(() => { DiscourseURL.routeTo(self.get("topicController.model.url")); });
}, function() { }, function() {
// failure // failure

View File

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

View File

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

View File

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