mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 12:34:06 +08:00
Add cancel button to delete replies dialog
This commit is contained in:
parent
73711bc4b8
commit
2d6759d5a0
|
@ -463,24 +463,26 @@ Discourse.TopicController = Discourse.ObjectController.extend(Discourse.Selected
|
||||||
|
|
||||||
// If the user is staff and the post has replies, ask if they want to delete replies too.
|
// If the user is staff and the post has replies, ask if they want to delete replies too.
|
||||||
if (user.get('staff') && replyCount > 0) {
|
if (user.get('staff') && replyCount > 0) {
|
||||||
bootbox.confirm(I18n.t("post.controls.delete_replies.confirm", {count: replyCount}),
|
bootbox.dialog(I18n.t("post.controls.delete_replies.confirm", {count: replyCount}), [
|
||||||
I18n.t("post.controls.delete_replies.no_value"),
|
{label: I18n.t("cancel"),
|
||||||
I18n.t("post.controls.delete_replies.yes_value"),
|
'class': 'btn-danger right'},
|
||||||
function(result) {
|
{label: I18n.t("post.controls.delete_replies.no_value"),
|
||||||
|
callback: function() {
|
||||||
// If the user wants to delete replies, do that, otherwise delete the post as normal.
|
post.destroy(user);
|
||||||
if (result) {
|
}
|
||||||
|
},
|
||||||
|
{label: I18n.t("post.controls.delete_replies.yes_value"),
|
||||||
|
'class': 'btn-primary',
|
||||||
|
callback: function() {
|
||||||
Discourse.Post.deleteMany([post], [post]);
|
Discourse.Post.deleteMany([post], [post]);
|
||||||
self.get('postStream.posts').forEach(function (p) {
|
self.get('postStream.posts').forEach(function (p) {
|
||||||
if (p === post || p.get('reply_to_post_number') === post.get('post_number')) {
|
if (p === post || p.get('reply_to_post_number') === post.get('post_number')) {
|
||||||
p.setDeletedState(user);
|
p.setDeletedState(user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
post.destroy(user);
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
});
|
]);
|
||||||
} else {
|
} else {
|
||||||
post.destroy(user);
|
post.destroy(user);
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,10 @@
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
.modal-footer .btn.right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
.modal-footer .btn-group .btn + .btn {
|
.modal-footer .btn-group .btn + .btn {
|
||||||
margin-left: -1px;
|
margin-left: -1px;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user