Move post Restore control into same section as Delete Forever

This commit is contained in:
Toby Zerner 2015-09-22 17:58:19 +09:30
parent ab88d94150
commit 3a41cb5a86

View File

@ -57,13 +57,7 @@ export default {
const items = new ItemList();
if (post.contentType() === 'comment' && post.canEdit()) {
if (post.isHidden()) {
items.add('restore', Button.component({
icon: 'reply',
children: app.trans('core.restore'),
onclick: this.restoreAction.bind(post)
}));
} else {
if (!post.isHidden()) {
items.add('edit', Button.component({
icon: 'pencil',
children: app.trans('core.edit'),
@ -87,19 +81,30 @@ export default {
destructiveControls(post) {
const items = new ItemList();
if (post.contentType() === 'comment' && !post.isHidden() && post.canEdit()) {
if (post.contentType() === 'comment' && !post.isHidden()) {
if (post.canEdit()) {
items.add('hide', Button.component({
icon: 'times',
icon: 'trash-o',
children: app.trans('core.delete'),
onclick: this.hideAction.bind(post)
}));
} else if (post.number() !== 1 && (post.contentType() !== 'comment' || post.isHidden()) && post.canDelete()) {
}
} else {
if (post.canEdit()) {
items.add('restore', Button.component({
icon: 'reply',
children: app.trans('core.restore'),
onclick: this.restoreAction.bind(post)
}));
}
if (post.canDelete() && post.number() !== 1) {
items.add('delete', Button.component({
icon: 'times',
children: app.trans('core.delete_forever'),
onclick: this.deleteAction.bind(post)
}));
}
}
return items;
},