mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 13:54:35 +03:00
10f83ebd45
refs https://github.com/TryGhost/Team/issues/910 - added `card-is-available` helper that handles the previous `card.developerExperiment` and the new `card.feature` options - updated `<KoenigMenuContent>` to use the `card-is-available` helper in the conditional when adding cards to the list Cards can be gated by feature when specifying them in `cards.js`, in the card definition object you can add `feature: 'flagName'` which will mean the card is only available when that feature is enabled.
23 lines
565 B
JavaScript
23 lines
565 B
JavaScript
import Helper from '@ember/component/helper';
|
|
import {get} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
|
|
export default class CardIsAvailableHelper extends Helper {
|
|
@service config;
|
|
@service feature;
|
|
|
|
compute([card]) {
|
|
let cardIsAvailable = true;
|
|
|
|
if (card.developerExperiment) {
|
|
cardIsAvailable = this.config.get('enableDeveloperExperiments');
|
|
}
|
|
|
|
if (card.feature) {
|
|
cardIsAvailable = get(this.feature, card.feature);
|
|
}
|
|
|
|
return cardIsAvailable;
|
|
}
|
|
}
|