mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 22:53:37 +08:00
Move post Restore control into same section as Delete Forever
This commit is contained in:
parent
ab88d94150
commit
3a41cb5a86
|
@ -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,19 +81,30 @@ 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()) {
|
||||||
|
if (post.canEdit()) {
|
||||||
items.add('hide', Button.component({
|
items.add('hide', Button.component({
|
||||||
icon: 'times',
|
icon: 'trash-o',
|
||||||
children: app.trans('core.delete'),
|
children: app.trans('core.delete'),
|
||||||
onclick: this.hideAction.bind(post)
|
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({
|
items.add('delete', Button.component({
|
||||||
icon: 'times',
|
icon: 'times',
|
||||||
children: app.trans('core.delete_forever'),
|
children: app.trans('core.delete_forever'),
|
||||||
onclick: this.deleteAction.bind(post)
|
onclick: this.deleteAction.bind(post)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user