mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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() {
|
||||
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) {
|
||||
modalController.set("onSelectPanel", controller.actions.onSelectPanel);
|
||||
modalController.set(
|
||||
"onSelectPanel",
|
||||
controller.actions.onSelectPanel.bind(controller)
|
||||
);
|
||||
}
|
||||
|
||||
modalController.set(
|
||||
|
@ -18,10 +18,6 @@ export default Mixin.create({
|
||||
closeModal() {
|
||||
this.modal.send("closeModal");
|
||||
this.set("panels", []);
|
||||
},
|
||||
|
||||
onSelectPanel(panel) {
|
||||
this.set("selectedPanel", panel);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user