mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
DEV: Convert admin component definitions to native class syntax (#20311)
This conversion was achieved using the ember-native-class-codemod, plus a handful of manual fixes/tweaks
This commit is contained in:
@ -1,15 +1,15 @@
|
||||
import { classNames } from "@ember-decorators/component";
|
||||
import Component from "@ember/component";
|
||||
import { action } from "@ember/object";
|
||||
import discourseComputed from "discourse-common/utils/decorators";
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ["inline-edit"],
|
||||
|
||||
buffer: null,
|
||||
bufferModelId: null,
|
||||
@classNames("inline-edit")
|
||||
export default class InlineEditCheckbox extends Component {
|
||||
buffer = null;
|
||||
bufferModelId = null;
|
||||
|
||||
didReceiveAttrs() {
|
||||
this._super(...arguments);
|
||||
super.didReceiveAttrs(...arguments);
|
||||
|
||||
if (this.modelId !== this.bufferModelId) {
|
||||
// HACK: The condition above ensures this method is called only when its
|
||||
@ -24,21 +24,21 @@ export default Component.extend({
|
||||
bufferModelId: this.modelId,
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@discourseComputed("checked", "buffer")
|
||||
changed(checked, buffer) {
|
||||
return !!checked !== !!buffer;
|
||||
},
|
||||
}
|
||||
|
||||
@action
|
||||
apply() {
|
||||
this.set("checked", this.buffer);
|
||||
this.action();
|
||||
},
|
||||
}
|
||||
|
||||
@action
|
||||
cancel() {
|
||||
this.set("buffer", this.checked);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user