mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
update: forum/utils/PostControls
This commit is contained in:
committed by
Franz Liedke
parent
aa4b58d7aa
commit
f664fa5be7
@@ -61,11 +61,13 @@ export default {
|
|||||||
if (!post.isHidden()) {
|
if (!post.isHidden()) {
|
||||||
items.add(
|
items.add(
|
||||||
'edit',
|
'edit',
|
||||||
Button.component({
|
Button.component(
|
||||||
icon: 'fas fa-pencil-alt',
|
{
|
||||||
children: app.translator.trans('core.forum.post_controls.edit_button'),
|
icon: 'fas fa-pencil-alt',
|
||||||
onclick: this.editAction.bind(post),
|
onclick: this.editAction.bind(post),
|
||||||
})
|
},
|
||||||
|
app.translator.trans('core.forum.post_controls.edit_button')
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -89,32 +91,38 @@ export default {
|
|||||||
if (post.canHide()) {
|
if (post.canHide()) {
|
||||||
items.add(
|
items.add(
|
||||||
'hide',
|
'hide',
|
||||||
Button.component({
|
Button.component(
|
||||||
icon: 'far fa-trash-alt',
|
{
|
||||||
children: app.translator.trans('core.forum.post_controls.delete_button'),
|
icon: 'far fa-trash-alt',
|
||||||
onclick: this.hideAction.bind(post),
|
onclick: this.hideAction.bind(post),
|
||||||
})
|
},
|
||||||
|
app.translator.trans('core.forum.post_controls.delete_button')
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (post.contentType() === 'comment' && post.canHide()) {
|
if (post.contentType() === 'comment' && post.canHide()) {
|
||||||
items.add(
|
items.add(
|
||||||
'restore',
|
'restore',
|
||||||
Button.component({
|
Button.component(
|
||||||
icon: 'fas fa-reply',
|
{
|
||||||
children: app.translator.trans('core.forum.post_controls.restore_button'),
|
icon: 'fas fa-reply',
|
||||||
onclick: this.restoreAction.bind(post),
|
onclick: this.restoreAction.bind(post),
|
||||||
})
|
},
|
||||||
|
app.translator.trans('core.forum.post_controls.restore_button')
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (post.canDelete()) {
|
if (post.canDelete()) {
|
||||||
items.add(
|
items.add(
|
||||||
'delete',
|
'delete',
|
||||||
Button.component({
|
Button.component(
|
||||||
icon: 'fas fa-times',
|
{
|
||||||
children: app.translator.trans('core.forum.post_controls.delete_forever_button'),
|
icon: 'fas fa-times',
|
||||||
onclick: this.deleteAction.bind(post, context),
|
onclick: this.deleteAction.bind(post, context),
|
||||||
})
|
},
|
||||||
|
app.translator.trans('core.forum.post_controls.delete_forever_button')
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -128,14 +136,10 @@ export default {
|
|||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
editAction() {
|
editAction() {
|
||||||
const deferred = m.deferred();
|
|
||||||
|
|
||||||
app.composer.load(EditPostComposer, { post: this });
|
app.composer.load(EditPostComposer, { post: this });
|
||||||
app.composer.show();
|
app.composer.show();
|
||||||
|
|
||||||
deferred.resolve(app.composer);
|
return Promise.resolve(app.composer);
|
||||||
|
|
||||||
return deferred.promise;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user