DEV: Replace bootbox confirm dialog (#64)

This commit is contained in:
Jan Cernik 2022-10-27 16:21:54 -03:00 committed by GitHub
parent fafc8647ab
commit db8479fbce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 17 deletions

View File

@ -2,9 +2,10 @@ import I18n from "I18n";
import discourseComputed, { on } from "discourse-common/utils/decorators"; import discourseComputed, { on } from "discourse-common/utils/decorators";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import Controller from "@ember/controller"; import Controller from "@ember/controller";
import bootbox from "bootbox"; import { inject as service } from "@ember/service";
export default Controller.extend({ export default Controller.extend({
dialog: service(),
newNote: null, newNote: null,
saving: false, saving: false,
user: null, user: null,
@ -52,12 +53,9 @@ export default Controller.extend({
}, },
removeNote(note) { removeNote(note) {
bootbox.confirm( this.dialog.deleteConfirm({
I18n.t("user_notes.delete_confirm"), message: I18n.t("user_notes.delete_confirm"),
I18n.t("no_value"), didConfirm: () => {
I18n.t("yes_value"),
(result) => {
if (result) {
note note
.destroyRecord() .destroyRecord()
.then(() => { .then(() => {
@ -65,9 +63,8 @@ export default Controller.extend({
this._refreshCount(); this._refreshCount();
}) })
.catch(popupAjaxError); .catch(popupAjaxError);
} },
} });
);
}, },
}, },
}); });