Added {{enable-developer-experiments}} helper

no issue

- removes the need to have component backing classes with the `config` service injected
This commit is contained in:
Kevin Ansfield 2020-10-09 11:10:39 +01:00
parent 508b7734fe
commit 235d5f1b8b
6 changed files with 13 additions and 7 deletions

View File

@ -140,7 +140,7 @@
{{/if}}
</section>
{{#if (or this.config.enableDeveloperExperiments this.config.portal)}}
{{#if (or enable-developer-experiments this.config.portal)}}
<section class="bb b--whitegrey pa5">
<div class="flex justify-between">
<div>

View File

@ -64,7 +64,7 @@
<GhErrorMessage @errors={{this.webhook.errors}} @property="targetUrl" data-test-error="webhook-targetUrl" />
</GhFormGroup>
</fieldset>
{{#if this.config.enableDeveloperExperiments}}
{{#if enable-developer-experiments}}
<fieldset>
<GhFormGroup @errors={{this.webhook.errors}} @hasValidated={{this.webhook.hasValidated}} @property="secret">
<label for="webhook-secret" class="fw6">Secret</label>

View File

@ -7,7 +7,6 @@ import {inject as service} from '@ember/service';
import {task} from 'ember-concurrency';
export default ModalComponent.extend({
config: service(),
router: service(),
availableEvents: null,

View File

@ -0,0 +1,10 @@
import Helper from '@ember/component/helper';
import {inject as service} from '@ember/service';
export default Helper.extend({
config: service(),
compute() {
return this.config.get('enableDeveloperExperiments');
}
});

View File

@ -3,7 +3,7 @@
{{section.title}}
</div>
{{#each section.items as |item|}}
{{#if (or (not item.developerExperiment) (and item.developerExperiment config.enableDeveloperExperiments))}}
{{#if (or (not item.developerExperiment) (and item.developerExperiment enable-developer-experiments))}}
<div class="{{if item.selected "kg-cardmenu-card-selected"}} {{kg-style "cardmenu-card"}}" onclick={{action itemClicked item}} data-kg="cardmenu-card" role="menuitem">
<div class="{{kg-style "cardmenu-icon"}} {{item.iconClass}}" aria-hidden="true">{{svg-jar item.icon class="w8 h8"}}</div>
<div class="{{kg-style "cardmenu-label"}}">{{item.label}}</div>

View File

@ -1,9 +1,6 @@
import Component from '@ember/component';
import {inject as service} from '@ember/service';
export default Component.extend({
config: service(),
tagName: '',
itemSections: null,