-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: align tutorial/part-2 titles with index and recap
- Loading branch information
1 parent
6e77e19
commit bebc4b7
Showing
4 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,13 @@ Now that we are fetching real data from our "server", let's add a new feature | |
|
||
While adding these rental pages, you will learn about: | ||
|
||
- Routes with dynamic segments | ||
- Links with dynamic segments | ||
- Component tests with access to the router | ||
- Accessing parameters from dynamic segments | ||
- Sharing common setup code between tests | ||
- Routes avec segments dynamiques | ||
- Liens avec segments dynamiques | ||
- Tests de composants avec accès au routeur | ||
- Accéder aux paramètres des segments dynamiques | ||
- Partager des configurations communes entre les tests | ||
|
||
## Routes with Dynamic Segments | ||
## Routes avec segments dynamiques | ||
|
||
It would be great for our individual rental pages to be available through predictable URLs like `/rentals/grand-old-mansion`. Also, since these pages are dedicated to individual rentals, we can show more detailed information about each property on this page. It would also be nice to be able to have a way to bookmark a rental property, and share direct links to each individual rental listing so that our users can come back to these pages later on, after they are done browsing. | ||
|
||
|
@@ -36,7 +36,7 @@ Router.map(function () { | |
|
||
Notice that we are doing something a little different here. Instead of using the default path (`/rental`), we're specifying a custom path. Not only are we using a custom path, but we're also passing in a `:rental_id`, which is what we call a _[dynamic segment](../../../routing/defining-your-routes/#toc_dynamic-segments)_. When these routes are evaluated, the `rental_id` will be substituted with the `id` of the individual rental property that we are trying to navigate to. | ||
|
||
## Links with Dynamic Segments | ||
## Liens avec segments dynamiques | ||
|
||
Now that we have this route in place, we can update our `<Rental>` component to actually _link_ to each of our detailed rental properties! | ||
|
||
|
@@ -178,7 +178,7 @@ If we run the tests in the browser, everything should just pass! | |
|
||
<img src="/images/tutorial/part-2/route-params/[email protected]" alt="Tests are passing" width="1024" height="768"> | ||
|
||
## Accessing Parameters from Dynamic Segments | ||
## Accéder aux paramètres des segments dynamiques | ||
|
||
Super ! We're making such great progress. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,10 +8,10 @@ As promised, we will now work on implementing the share button! | |
|
||
While adding the share button, you will learn about: | ||
|
||
- Splattributes and the `class` attribute | ||
- The router service | ||
- Ember services vs. global variables | ||
- Mocking services in tests | ||
- _Splattributes_ et l'attribut `class` | ||
- Le service routeur | ||
- Services Ember versus variables globales | ||
- _Mocker_ des services dans les tests | ||
|
||
## Scoping the Feature | ||
|
||
|
@@ -352,13 +352,13 @@ export default class ShareButtonComponent extends Component { | |
} | ||
``` | ||
|
||
Here, we added the `@service router;` declaration to our component class. This injects the router service into the component, making it available to us as `this.router`. The router service has a `currentURL` property, providing the current "logical" URL as seen by Ember's router. Similar to the test helper with the same name, this is a relative URL, so we would have to join it with `window.location.origin` to get an absolute URL that we can share. | ||
Here, we added the `@service router;` declaration to our component class. This injects the router service into the component, making it available to us as `this.router`. Le service routeur has a `currentURL` property, providing the current "logical" URL as seen by Ember's router. Similar to the test helper with the same name, this is a relative URL, so we would have to join it with `window.location.origin` to get an absolute URL that we can share. | ||
|
||
With this change, everything is now working the way we intended. | ||
|
||
<img src="/images/tutorial/part-2/service-injection/[email protected]" alt="The previously failing test is now green" width="1024" height="960"> | ||
|
||
## Ember Services vs. Global Variables | ||
## Services Ember versus variables globales | ||
|
||
In Ember, services serve a similar role to global variables, in that they can be easily accessed by any part of your app. For example, we can inject any available service into components, as opposed to having them passed in as an argument. This allows deeply nested components to "skip through" the layers and access things that are logically global to the entire app, such as routing, authentication, user sessions, user preferences, etc. Without services, every component would have to pass through a lot of the same arguments into every component it invokes. | ||
|
||
|