1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/app/components/gh-feature-flag.js
Naz Gargol 8dff0ee6d4
🔥 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

48 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;