DEV: update yes/no confirmation dialogs (#18181)

This commit is contained in:
Penar Musaraj
2022-09-14 11:06:56 -04:00
committed by GitHub
parent 04e433d286
commit 86ecb6c58b
30 changed files with 506 additions and 617 deletions

View File

@ -1,30 +1,29 @@
import Controller from "@ember/controller";
import I18n from "I18n";
import bootbox from "bootbox";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { inject as service } from "@ember/service";
import { action } from "@ember/object";
export default Controller.extend({
actions: {
destroy(webhook) {
return bootbox.confirm(
I18n.t("admin.web_hooks.delete_confirm"),
I18n.t("no_value"),
I18n.t("yes_value"),
(result) => {
if (result) {
webhook
.destroyRecord()
.then(() => {
this.model.removeObject(webhook);
})
.catch(popupAjaxError);
}
}
);
},
dialog: service(),
loadMore() {
this.model.loadMore();
},
@action
destroy(webhook) {
return this.dialog.yesNoConfirm({
message: I18n.t("admin.web_hooks.delete_confirm"),
didConfirm: () => {
webhook
.destroyRecord()
.then(() => {
this.model.removeObject(webhook);
})
.catch(popupAjaxError);
},
});
},
@action
loadMore() {
this.model.loadMore();
},
});