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