mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 08:13:34 +03:00
9adbcd1fd0
no issue Automated tools, code generators, and editor integrations are increasingly standardising on the import style used in `ember-modules-codemod`. Our import style differed a little with regards to service/controller injection imports which meant we were starting to see inconsistent naming.
42 lines
956 B
JavaScript
42 lines
956 B
JavaScript
import Component from '@ember/component';
|
|
import {computed} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
const FeatureFlagComponent = Component.extend({
|
|
tagName: 'label',
|
|
classNames: 'checkbox',
|
|
attributeBindings: ['for'],
|
|
_flagValue: null,
|
|
|
|
feature: service(),
|
|
|
|
init() {
|
|
this._super(...arguments);
|
|
|
|
this.set('_flagValue', this.get(`feature.${this.get('flag')}`));
|
|
},
|
|
|
|
value: computed('_flagValue', {
|
|
get() {
|
|
return this.get('_flagValue');
|
|
},
|
|
set(key, value) {
|
|
return this.set(`feature.${this.get('flag')}`, value);
|
|
}
|
|
}),
|
|
|
|
for: computed('flag', function () {
|
|
return `labs-${this.get('flag')}`;
|
|
}),
|
|
|
|
name: computed('flag', function () {
|
|
return `labs[${this.get('flag')}]`;
|
|
})
|
|
});
|
|
|
|
FeatureFlagComponent.reopenClass({
|
|
positionalParams: ['flag']
|
|
});
|
|
|
|
export default FeatureFlagComponent;
|