Skip to content

Commit b974634

Browse files
authored
Merge pull request #2080 from ember-learn/feature-flag
Introducing template-tag feature flag
2 parents 9bb09d9 + c2ac348 commit b974634

File tree

5 files changed

+10575
-8602
lines changed

5 files changed

+10575
-8602
lines changed

app/controllers/application.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import GuideMakerApp from 'guidemaker/controllers/application';
2+
3+
export default class ApplicationController extends GuideMakerApp {
4+
queryParams = ['feature_flags'];
5+
}

app/routes/application.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import GuideMakerApp from 'guidemaker/routes/application';
2+
import { service } from '@ember/service';
3+
4+
const FEATURES = {
5+
'template-tag': false,
6+
};
7+
8+
export default class ApplicationRoute extends GuideMakerApp {
9+
@service features;
10+
11+
model(params, ...rest) {
12+
let { feature_flags } = params;
13+
let overrides = Object.fromEntries(
14+
feature_flags?.split(',').map((flag) => [flag, true]) ?? [],
15+
);
16+
this.features.setupFeatures(Object.assign({}, FEATURES, overrides));
17+
return super.model(params, ...rest);
18+
}
19+
}

guides/release/getting-started/quick-start.md

+18
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,22 @@ Congratulations! You just created and booted your first Ember app.
8787

8888
## Write some HTML in a template
8989

90+
<feature-flag-on-template-tag>
91+
92+
We will start by editing the `application` template.
93+
This template is always on screen while the user has your application loaded.
94+
In your editor, open `app/templates/application.gjs` and change it to the following:
95+
96+
```gjs {data-filename=app/templates/application.gjs}
97+
<template>
98+
<h1>PeopleTracker</h1>
99+
{{outlet}}
100+
</template>
101+
```
102+
</feature-flag-on-template-tag>
103+
104+
<feature-flag-off-template-tag>
105+
90106
We will start by editing the `application` template.
91107
This template is always on screen while the user has your application loaded.
92108
In your editor, open `app/templates/application.hbs` and change it to the following:
@@ -97,6 +113,8 @@ In your editor, open `app/templates/application.hbs` and change it to the follow
97113
{{outlet}}
98114
```
99115

116+
</feature-flag-off-template-tag>
117+
100118
Ember detects the changed file and automatically reloads the page for you in the background.
101119
You should see that the welcome page has been replaced by "PeopleTracker".
102120
You also added an `{{outlet}}` to this page,

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
"eslint-plugin-prettier": "^5.2.1",
9393
"eslint-plugin-qunit": "^8.1.2",
9494
"gfm-code-blocks": "^1.0.0",
95-
"guidemaker": "^4.0.3",
96-
"guidemaker-ember-template": "^4.0.1",
95+
"guidemaker": "^4.0.4",
96+
"guidemaker-ember-template": "^4.1.0",
9797
"loader.js": "^4.7.0",
9898
"lodash": "^4.17.21",
9999
"markdown-link-extractor": "1.2.3",

0 commit comments

Comments
 (0)