Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing template-tag feature flag #2080

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"eslint-plugin-qunit": "^7.2.0",
"gfm-code-blocks": "^1.0.0",
"guidemaker": "^4.0.3",
"guidemaker-ember-template": "^4.0.1",
"guidemaker-ember-template": "^4.1.0",
"loader.js": "^4.7.0",
"lodash": "^4.17.21",
"markdown-link-extractor": "1.2.3",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading