Ghost/ghost/admin/app/components/gh-feature-flag.js
Naz Gargol 7e3412ce8e 🔥 Removed all subscriber feature related code (#1337)
refs https://github.com/TryGhost/Ghost/pull/11153

- Removed all subscriber feature related code
- The feature is being substituted by members
2019-09-26 15:58:01 +02:00

49 lines
1.2 KiB
JavaScript

import Component from '@ember/component';
import {computed, defineProperty} from '@ember/object';
import {readOnly} from '@ember/object/computed';
import {inject as service} from '@ember/service';
const FeatureFlagComponent = Component.extend({
feature: service(),
tagName: 'label',
classNames: 'checkbox',
attributeBindings: ['for', 'disabled'],
disabled: computed('_disabled', function () {
if (this._disabled) {
return true;
}
return false;
}),
value: computed('_flagValue', {
get() {
return this._flagValue;
},
set(key, value) {
return this.set(`feature.${this.flag}`, value);
}
}),
for: computed('flag', function () {
return `labs-${this.flag}`;
}),
name: computed('flag', function () {
return `labs[${this.flag}]`;
}),
init() {
this._super(...arguments);
defineProperty(this, '_flagValue', readOnly(`feature.${this.flag}`), function () {
return this.get(`feature.${this.flag}`);
});
}
});
FeatureFlagComponent.reopenClass({
positionalParams: ['flag', '_disabled']
});
export default FeatureFlagComponent;