DEV: Replace bootbox confirm dialog (#64)
This commit is contained in:
parent
fafc8647ab
commit
db8479fbce
|
@ -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,22 +53,18 @@ 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"),
|
note
|
||||||
(result) => {
|
.destroyRecord()
|
||||||
if (result) {
|
.then(() => {
|
||||||
note
|
this.model.removeObject(note);
|
||||||
.destroyRecord()
|
this._refreshCount();
|
||||||
.then(() => {
|
})
|
||||||
this.model.removeObject(note);
|
.catch(popupAjaxError);
|
||||||
this._refreshCount();
|
},
|
||||||
})
|
});
|
||||||
.catch(popupAjaxError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue