mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 14:46:18 +08:00
b8ee52c4cb
Previously, focus wasn't being applied correctly on dialogs using named components. This was because the A11YDialog was being invoked before the component was completely rendered. The long-term plan is to move away from A11YDialog doing the rendering here, but for now this should do.
33 lines
907 B
JavaScript
33 lines
907 B
JavaScript
import Controller, { inject as controller } from "@ember/controller";
|
|
import { action } from "@ember/object";
|
|
import { inject as service } from "@ember/service";
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
import I18n from "discourse-i18n";
|
|
|
|
export default class AdminWebHooksShowController extends Controller {
|
|
@service dialog;
|
|
@service router;
|
|
@controller adminWebHooks;
|
|
|
|
@action
|
|
edit() {
|
|
return this.router.transitionTo("adminWebHooks.edit", this.model);
|
|
}
|
|
|
|
@action
|
|
destroyWebhook() {
|
|
return this.dialog.deleteConfirm({
|
|
message: I18n.t("admin.web_hooks.delete_confirm"),
|
|
didConfirm: async () => {
|
|
try {
|
|
await this.model.destroyRecord();
|
|
this.adminWebHooks.model.removeObject(this.model);
|
|
this.router.transitionTo("adminWebHooks");
|
|
} catch (e) {
|
|
popupAjaxError(e);
|
|
}
|
|
},
|
|
});
|
|
}
|
|
}
|