mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Convert track-selected to glimmer/gjs (#26773)
This commit is contained in:
parent
fb40f50865
commit
2a52f7f13f
@ -0,0 +1,20 @@
|
||||
import Component from "@glimmer/component";
|
||||
import { on } from "@ember/modifier";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default class TrackSelected extends Component {
|
||||
@action
|
||||
onToggle(e) {
|
||||
if (e.target.checked) {
|
||||
this.args.selectedList.addObject(this.args.selectedId);
|
||||
} else {
|
||||
this.args.selectedList.removeObject(this.args.selectedId);
|
||||
}
|
||||
}
|
||||
|
||||
<template>
|
||||
<span class={{@class}} ...attributes>
|
||||
<input {{on "input" this.onToggle}} type="checkbox" />
|
||||
</span>
|
||||
</template>
|
||||
}
|
@ -1 +0,0 @@
|
||||
<Input @type="checkbox" @checked={{this.selected}} />
|
@ -1,19 +0,0 @@
|
||||
import Component from "@ember/component";
|
||||
import { observes } from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
tagName: "span",
|
||||
|
||||
@observes("selected")
|
||||
selectionChanged() {
|
||||
const selected = this.selected;
|
||||
const list = this.selectedList;
|
||||
const id = this.selectedId;
|
||||
|
||||
if (selected) {
|
||||
list.addObject(id);
|
||||
} else {
|
||||
list.removeObject(id);
|
||||
}
|
||||
},
|
||||
});
|
Loading…
Reference in New Issue
Block a user