2020-02-19 11:57:59 -05:00
|
|
|
import { on } from "discourse-common/utils/decorators";
|
2019-07-16 06:46:32 -04:00
|
|
|
|
2015-07-08 16:45:13 -04:00
|
|
|
export default Ember.Component.extend({
|
2018-10-10 07:56:23 -04:00
|
|
|
classNameBindings: [":schema-table", "open"],
|
|
|
|
tagName: "li",
|
2015-07-08 16:45:13 -04:00
|
|
|
|
2019-07-16 06:46:32 -04:00
|
|
|
open: Ember.computed.reads("table.open"),
|
2015-07-08 16:45:13 -04:00
|
|
|
|
2019-07-16 06:46:32 -04:00
|
|
|
@on("didInsertElement")
|
|
|
|
_bindClicks() {
|
|
|
|
$(this.element)
|
2018-10-10 07:56:23 -04:00
|
|
|
.find(".schema-table-name")
|
2019-07-16 06:46:32 -04:00
|
|
|
.click(e => {
|
2019-07-25 01:50:31 -04:00
|
|
|
this.set("table.open", !this.table.open);
|
2018-10-10 07:56:23 -04:00
|
|
|
e.preventDefault();
|
|
|
|
});
|
2019-07-16 06:46:32 -04:00
|
|
|
},
|
2015-07-09 18:46:19 -04:00
|
|
|
|
2019-07-16 06:46:32 -04:00
|
|
|
@on("willDestroyElement")
|
|
|
|
_cleanup() {
|
|
|
|
$(this.element)
|
2018-10-10 07:56:23 -04:00
|
|
|
.find(".schema-table-name")
|
|
|
|
.off("click");
|
2019-07-16 06:46:32 -04:00
|
|
|
}
|
2015-07-08 16:45:13 -04:00
|
|
|
});
|