Skip to content

Commit c275bbd

Browse files
committed
update anatomy-of-an-ember-app to gjs
1 parent f220607 commit c275bbd

File tree

4 files changed

+507
-22
lines changed

4 files changed

+507
-22
lines changed

guides/release/getting-started/anatomy-of-an-ember-app.md

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Before you start writing any Ember code, it's a good idea to get an overview of how an
22
Ember application works.
33

4-
![ember core concepts](/images/ember-core-concepts/ember-core-concepts.svg)
4+
![ember core concepts](/images/ember-core-concepts/ember-core-concepts-gjs.svg)
55

66
## Router and Route Handlers
77

@@ -51,8 +51,10 @@ Ember uses templates to build up the user interface in an application.
5151
If you have written HTML before, you already know how to write a basic Ember
5252
template. For example:
5353

54-
```handlebars {data-filename="app/templates/welcome.hbs"}
55-
<div>Hi, this is a valid Ember template!</div>
54+
```gjs {data-filename="app/templates/welcome.gjs"}
55+
<template>
56+
<div>Hi, this is a valid Ember template!</div>
57+
</template>
5658
```
5759

5860
In addition to static HTML content, Ember uses the syntax of [Handlebars](http://handlebarsjs.com)
@@ -61,17 +63,19 @@ to describe dynamic user interface elements.
6163
For example, as mentioned before, the route handler makes the model available
6264
to its template:
6365

64-
```handlebars {data-filename="app/templates/welcome.hbs"}
65-
{{!-- The model for this route is the current user --}}
66+
```gjs {data-filename="app/templates/welcome.gjs"}
67+
<template>
68+
{{!-- The model for this route is the current user --}}
6669
67-
<div>
68-
Hi <img src="{{@model.profileImage}}" alt="{{@model.name}}'s profile picture"> {{@model.name}},
69-
this is a valid Ember template!
70-
</div>
70+
<div>
71+
Hi <img src="{{@model.profileImage}}" alt="{{@model.name}}'s profile picture"> {{@model.name}},
72+
this is a valid Ember template!
73+
</div>
7174
72-
{{#if @model.isAdmin}}
73-
<div>Remember, with great power comes great responsibility!</div>
74-
{{/if}}
75+
{{#if @model.isAdmin}}
76+
<div>Remember, with great power comes great responsibility!</div>
77+
{{/if}}
78+
</template>
7579
```
7680

7781
This example combines several Handlebars features to create a personalized
@@ -98,22 +102,28 @@ For example, the example in the previous section is getting a bit long. We can
98102
_extract_ the snippet for rendering the user's name and profile picture into
99103
its own component:
100104

101-
```handlebars {data-filename="app/components/user-profile.hbs"}
102-
<img src="{{@user.profileImage}}" alt="{{@user.name}}'s profile picture"> {{@user.name}}
105+
```gjs {data-filename="app/components/user-profile.gjs"}
106+
<template>
107+
<img src="{{@user.profileImage}}" alt="{{@user.name}}'s profile picture"> {{@user.name}}
108+
</template>
103109
```
104110

105111
Doing this allows us to simplify the original template like so:
106112

107-
```handlebars {data-filename="app/templates/welcome.hbs"}
108-
{{!-- The model for this route is the current user --}}
113+
```gjs {data-filename="app/templates/welcome.gjs"}
114+
import UserProfile from 'my-app/components/user-profile';
109115
110-
<div>
111-
Hi <UserProfile @user={{@model}} /> this is a valid Ember template!
112-
</div>
116+
<template>
117+
{{!-- The model for this route is the current user --}}
113118
114-
{{#if @model.isAdmin}}
115-
<div>Remember, with great power comes great responsibility!</div>
116-
{{/if}}
119+
<div>
120+
Hi <UserProfile @user={{@model}} /> this is a valid Ember template!
121+
</div>
122+
123+
{{#if @model.isAdmin}}
124+
<div>Remember, with great power comes great responsibility!</div>
125+
{{/if}}
126+
</template>
117127
```
118128

119129
Not only did we clean up the original template to be more readable, we now
252 KB
Binary file not shown.
47.6 KB
Loading

0 commit comments

Comments
 (0)