Skip to content

Commit

Permalink
Merge pull request #2080 from ember-learn/feature-flag
Browse files Browse the repository at this point in the history
Introducing template-tag feature flag
  • Loading branch information
ef4 authored Jan 21, 2025
2 parents 9bb09d9 + c2ac348 commit b974634
Show file tree
Hide file tree
Showing 5 changed files with 10,575 additions and 8,602 deletions.
5 changes: 5 additions & 0 deletions app/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import GuideMakerApp from 'guidemaker/controllers/application';

export default class ApplicationController extends GuideMakerApp {
queryParams = ['feature_flags'];
}
19 changes: 19 additions & 0 deletions app/routes/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import GuideMakerApp from 'guidemaker/routes/application';
import { service } from '@ember/service';

const FEATURES = {
'template-tag': false,
};

export default class ApplicationRoute extends GuideMakerApp {
@service features;

model(params, ...rest) {
let { feature_flags } = params;
let overrides = Object.fromEntries(
feature_flags?.split(',').map((flag) => [flag, true]) ?? [],
);
this.features.setupFeatures(Object.assign({}, FEATURES, overrides));
return super.model(params, ...rest);
}
}
18 changes: 18 additions & 0 deletions guides/release/getting-started/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ Congratulations! You just created and booted your first Ember app.

## Write some HTML in a template

<feature-flag-on-template-tag>

We will start by editing the `application` template.
This template is always on screen while the user has your application loaded.
In your editor, open `app/templates/application.gjs` and change it to the following:

```gjs {data-filename=app/templates/application.gjs}
<template>
<h1>PeopleTracker</h1>
{{outlet}}
</template>
```
</feature-flag-on-template-tag>

<feature-flag-off-template-tag>

We will start by editing the `application` template.
This template is always on screen while the user has your application loaded.
In your editor, open `app/templates/application.hbs` and change it to the following:
Expand All @@ -97,6 +113,8 @@ In your editor, open `app/templates/application.hbs` and change it to the follow
{{outlet}}
```

</feature-flag-off-template-tag>

Ember detects the changed file and automatically reloads the page for you in the background.
You should see that the welcome page has been replaced by "PeopleTracker".
You also added an `{{outlet}}` to this page,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-qunit": "^8.1.2",
"gfm-code-blocks": "^1.0.0",
"guidemaker": "^4.0.3",
"guidemaker-ember-template": "^4.0.1",
"guidemaker": "^4.0.4",
"guidemaker-ember-template": "^4.1.0",
"loader.js": "^4.7.0",
"lodash": "^4.17.21",
"markdown-link-extractor": "1.2.3",
Expand Down
Loading

0 comments on commit b974634

Please sign in to comment.