Skip to content

Commit 52a367d

Browse files
committed
Updates to the tutorial so it works on 5.11-beta
1 parent a1e7316 commit 52a367d

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/markdown/tutorial/part-1/01-orientation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,11 @@ As text on the welcome page pointed out, the source code for the page is located
270270
@@ -1,7 +1 @@
271271
-{{page-title "SuperRentals"}}
272272
-
273+
-{{outlet}}
274+
-
273275
-{{! The following component displays Ember's default welcome message. }}
274276
-<WelcomePage />
275277
-{{! Feel free to remove this! }}
276-
-
277-
-{{outlet}}
278278
\ No newline at end of file
279279
+Hello World!!!
280280
```

src/markdown/tutorial/part-1/06-interactive-components.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Ember will create an *[instance][TODO: link to instance]* of the class whenever
5555

5656
```run:file:patch lang=js cwd=super-rentals filename=app/components/rental/image.js
5757
@@ -3 +3,6 @@
58-
-export default class RentalImageComponent extends Component {}
59-
+export default class RentalImageComponent extends Component {
58+
-export default class RentalImage extends Component {}
59+
+export default class RentalImage extends Component {
6060
+ constructor(...args) {
6161
+ super(...args);
6262
+ this.isLarge = false;
@@ -121,7 +121,7 @@ Since this pattern of initializing instance variables in the constructor is pret
121121

122122
```run:file:patch lang=js cwd=super-rentals filename=app/components/rental/image.js
123123
@@ -3,6 +3,3 @@
124-
export default class RentalImageComponent extends Component {
124+
export default class RentalImage extends Component {
125125
- constructor(...args) {
126126
- super(...args);
127127
- this.isLarge = false;
@@ -149,7 +149,7 @@ Let's modify our class to add a *[method](../../../in-depth-topics/native-classe
149149
+import { tracked } from '@glimmer/tracking';
150150
+import { action } from '@ember/object';
151151

152-
export default class RentalImageComponent extends Component {
152+
export default class RentalImage extends Component {
153153
- isLarge = false;
154154
+ @tracked isLarge = false;
155155
+

src/markdown/tutorial/part-1/07-reusable-components.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,15 @@ Let's start with our JavaScript file:
107107
import Component from '@glimmer/component';
108108
+import ENV from 'super-rentals/config/environment';
109109

110-
-export default class MapComponent extends Component {}
111-
+export default class MapComponent extends Component {
110+
-export default class Map extends Component {}
111+
+export default class Map extends Component {
112112
+ get token() {
113113
+ return encodeURIComponent(ENV.MAPBOX_ACCESS_TOKEN);
114114
+ }
115115
+}
116116
```
117117

118-
Here, we import the access token from the config file and return it from a `token` *[getter](https://javascript.info/property-accessors)*. This allows us to access our token as `this.token` both inside the `MapComponent` class body, as well as the component's template. It is also important to [URL-encode](https://javascript.info/url#encoding-strings) the token, just in case it contains any special characters that are not URL-safe.
118+
Here, we import the access token from the config file and return it from a `token` *[getter](https://javascript.info/property-accessors)*. This allows us to access our token as `this.token` both inside the `Map` class body, as well as the component's template. It is also important to [URL-encode](https://javascript.info/url#encoding-strings) the token, just in case it contains any special characters that are not URL-safe.
119119

120120
## Interpolating Values in Templates
121121

@@ -334,7 +334,7 @@ index 78e765f..1cad468 100644
334334
335335
+const MAPBOX_API = 'https://api.mapbox.com/styles/v1/mapbox/streets-v11/static';
336336
+
337-
export default class MapComponent extends Component {
337+
export default class Map extends Component {
338338
+ get src() {
339339
+ let { lng, lat, width, height, zoom } = this.args;
340340
+

src/markdown/tutorial/part-2/10-service-injection.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ Whew! Let's look at the JavaScript class next.
8787

8888
```run:file:patch lang=js cwd=super-rentals filename=app/components/share-button.js
8989
@@ -3 +3,27 @@
90-
-export default class ShareButtonComponent extends Component {}
90+
-export default class ShareButton extends Component {}
9191
+const TWEET_INTENT = 'https://twitter.com/intent/tweet';
9292
+
93-
+export default class ShareButtonComponent extends Component {
93+
+export default class ShareButton extends Component {
9494
+ get currentURL() {
9595
+ return window.location.href;
9696
+ }
@@ -217,7 +217,7 @@ To fix our problem, we would need to do the same. Ember exposes this internal st
217217
+import { service } from '@ember/service';
218218
import Component from '@glimmer/component';
219219
@@ -5,4 +6,6 @@
220-
export default class ShareButtonComponent extends Component {
220+
export default class ShareButton extends Component {
221221
+ @service router;
222222
+
223223
get currentURL() {

src/markdown/tutorial/part-2/12-provider-components.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Now that we have our component all set up, we can finally wire up our search box
221221
import Component from '@glimmer/component';
222222
import { tracked } from '@glimmer/tracking';
223223

224-
export default class RentalsComponent extends Component {
224+
export default class Rentals extends Component {
225225
@tracked query = '';
226226
}
227227
```
@@ -257,7 +257,7 @@ Now that our search query is wired up to our `<Rentals>` component, we can get i
257257
```run:file:create lang=js cwd=super-rentals filename=app/components/rentals/filter.js
258258
import Component from '@glimmer/component';
259259

260-
export default class RentalsFilterComponent extends Component {
260+
export default class RentalsFilter extends Component {
261261
get results() {
262262
let { rentals, query } = this.args;
263263

0 commit comments

Comments
 (0)