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 { popupAjaxError } from "discourse/lib/ajax-error";
import Controller from "@ember/controller";
import bootbox from "bootbox";
import { inject as service } from "@ember/service";
export default Controller.extend({
dialog: service(),
newNote: null,
saving: false,
user: null,
@ -52,22 +53,18 @@ export default Controller.extend({
},
removeNote(note) {
bootbox.confirm(
I18n.t("user_notes.delete_confirm"),
I18n.t("no_value"),
I18n.t("yes_value"),
(result) => {
if (result) {
note
.destroyRecord()
.then(() => {
this.model.removeObject(note);
this._refreshCount();
})
.catch(popupAjaxError);
}
}
);
this.dialog.deleteConfirm({
message: I18n.t("user_notes.delete_confirm"),
didConfirm: () => {
note
.destroyRecord()
.then(() => {
this.model.removeObject(note);
this._refreshCount();
})
.catch(popupAjaxError);
},
});
},
},
});