DEV: Call onClose for closing modals.
This commit is contained in:
parent
0005bded6c
commit
d657ce844b
|
@ -39,6 +39,7 @@ export default function(name, opts) {
|
|||
modalController.set("modalClass", opts.modalClass);
|
||||
|
||||
const controllerName = opts.admin ? `modals/${name}` : name;
|
||||
modalController.set("name", controllerName);
|
||||
|
||||
let controller = container.lookup("controller:" + controllerName);
|
||||
const templateName = opts.templateName || Ember.String.dasherize(name);
|
||||
|
|
|
@ -144,6 +144,13 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
|||
// Close the current modal, and destroy its state.
|
||||
closeModal() {
|
||||
this.render("hide-modal", { into: "modal", outlet: "modalBody" });
|
||||
|
||||
const route = getOwner(this).lookup("route:application");
|
||||
const name = route.controllerFor("modal").get("name");
|
||||
const controller = getOwner(this).lookup(`controller:${name}`);
|
||||
if (controller && controller.onClose) {
|
||||
controller.onClose();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue