MODAL: Untangle `onSelectPanel`
Previously modal-tab component would call on click the onSelectPanel callback with itself (modal-tab) as `this` which severely limited its usefulness. Now showModal binds the callback to its controller.
This commit is contained in:
parent
126a1f550a
commit
b7f6ec60c5
|
@ -20,6 +20,10 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
click() {
|
click() {
|
||||||
this.onSelectPanel(this.panel);
|
this.set("selectedPanel", this.panel);
|
||||||
|
|
||||||
|
if (this.onSelectPanel) {
|
||||||
|
this.onSelectPanel(this.panel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,10 @@ export default function(name, opts) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (controller.actions.onSelectPanel) {
|
if (controller.actions.onSelectPanel) {
|
||||||
modalController.set("onSelectPanel", controller.actions.onSelectPanel);
|
modalController.set(
|
||||||
|
"onSelectPanel",
|
||||||
|
controller.actions.onSelectPanel.bind(controller)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
modalController.set(
|
modalController.set(
|
||||||
|
|
|
@ -18,10 +18,6 @@ export default Mixin.create({
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.modal.send("closeModal");
|
this.modal.send("closeModal");
|
||||||
this.set("panels", []);
|
this.set("panels", []);
|
||||||
},
|
|
||||||
|
|
||||||
onSelectPanel(panel) {
|
|
||||||
this.set("selectedPanel", panel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue