From c80c9f8ad8389a2b268a948c801abf6cedd7a4f9 Mon Sep 17 00:00:00 2001 From: Edward Faulkner Date: Tue, 3 Dec 2024 14:52:37 -0500 Subject: [PATCH] Introducing template-tag feature flag --- app/controllers/application.js | 5 +++++ app/routes/application.js | 19 +++++++++++++++++++ guides/release/getting-started/quick-start.md | 18 ++++++++++++++++++ package.json | 2 +- pnpm-lock.yaml | 8 ++++---- 5 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 app/controllers/application.js create mode 100644 app/routes/application.js diff --git a/app/controllers/application.js b/app/controllers/application.js new file mode 100644 index 0000000000..4233347383 --- /dev/null +++ b/app/controllers/application.js @@ -0,0 +1,5 @@ +import GuideMakerApp from 'guidemaker/controllers/application'; + +export default class ApplicationController extends GuideMakerApp { + queryParams = ['feature_flags']; +} diff --git a/app/routes/application.js b/app/routes/application.js new file mode 100644 index 0000000000..db3415084e --- /dev/null +++ b/app/routes/application.js @@ -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); + } +} diff --git a/guides/release/getting-started/quick-start.md b/guides/release/getting-started/quick-start.md index a2ec7d9247..43f89d10b5 100644 --- a/guides/release/getting-started/quick-start.md +++ b/guides/release/getting-started/quick-start.md @@ -87,6 +87,22 @@ Congratulations! You just created and booted your first Ember app. ## Write some HTML in a template + + +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} + +``` + + + + 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: @@ -97,6 +113,8 @@ In your editor, open `app/templates/application.hbs` and change it to the follow {{outlet}} ``` + + 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, diff --git a/package.json b/package.json index 65665cd966..a545a65c56 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8d6439fb5f..7e14c4463d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -147,8 +147,8 @@ devDependencies: specifier: ^4.0.3 version: 4.0.3(@ember-data/adapter@4.12.8)(@ember-data/model@4.12.8)(@ember-data/serializer@4.12.8)(ember-source@4.4.5)(showdown@2.1.0)(webpack@5.96.1) guidemaker-ember-template: - specifier: ^4.0.1 - version: 4.0.2(@babel/core@7.26.0)(@glimmer/tracking@1.1.2)(ember-cli-head@2.0.0)(ember-source@4.4.5)(guidemaker@4.0.3)(showdown@2.1.0)(webpack@5.96.1) + specifier: ^4.1.0 + version: 4.1.0(@babel/core@7.26.0)(@glimmer/tracking@1.1.2)(ember-cli-head@2.0.0)(ember-source@4.4.5)(guidemaker@4.0.3)(showdown@2.1.0)(webpack@5.96.1) loader.js: specifier: ^4.7.0 version: 4.7.0 @@ -10241,8 +10241,8 @@ packages: resolution: {integrity: sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw==} dev: true - /guidemaker-ember-template@4.0.2(@babel/core@7.26.0)(@glimmer/tracking@1.1.2)(ember-cli-head@2.0.0)(ember-source@4.4.5)(guidemaker@4.0.3)(showdown@2.1.0)(webpack@5.96.1): - resolution: {integrity: sha512-9CFYUQef31+ORmuo3MfA78Wm22A038AOZS1OowWQuFiKRXL3UWwiOQCIgcNmk2WE6JJ3s1H79nnMz6L65txxMQ==} + /guidemaker-ember-template@4.1.0(@babel/core@7.26.0)(@glimmer/tracking@1.1.2)(ember-cli-head@2.0.0)(ember-source@4.4.5)(guidemaker@4.0.3)(showdown@2.1.0)(webpack@5.96.1): + resolution: {integrity: sha512-d+w2aqdqHOg+lk7EgEKPmKLWwlSRRML0t0ad4ZhQ8g01Zcsu+etoR+F5WNyrPeYwOxMWZ2s/+cItVbqr15kDeg==} peerDependencies: ember-cli-head: '*' guidemaker: ^4.0.1