Repository navigation
Update for co-located templates (Part 1: "Getting Started") - #977
Merged
Merged
Conversation
chancancode
force-pushed
the
co-located-templates
branch
from
August 2, 2019 19:31
8e247cd to
770c12c
Compare
chancancode
commented
Aug 2, 2019
| * It loads a model. | ||
| * It renders a template, which has access to the model. | ||
|
|
||
| ## Models |
Contributor
Author
There was a problem hiding this comment.
This is mostly just moved up from below.
chancancode
commented
Aug 2, 2019
|
|
||
| We will cover these advanced component features in a later chapter. | ||
|
|
||
| ## Lifecycle Hooks |
Contributor
Author
There was a problem hiding this comment.
This is kind of out-of-scope for my PR, but should this section be removed? The router hook is can be covered in the route handler section above if we want, and the component hook part is largely not applicable in octane anymore (I think?)
chancancode
commented
Aug 2, 2019
|
|
||
| Templates can also display properties provided to them from their context, which is either a component or a route's controller. For example: | ||
| <div> | ||
| Hi <img src="{{this.model.profileImage}}" alt="{{this.model.name}}'s profile picture"> {{this.model.name}}, |
Contributor
Author
There was a problem hiding this comment.
chancancode
commented
Aug 2, 2019
| <rect x="459.5" y="820.6" fill="none" width="251.8" height="105.7"/> | ||
| <text transform="matrix(1 0 0 1 513.165 841.1191)" fill="#010101" font-family="'Lato-Bold'" font-size="27.4501">Component</text> | ||
| <text transform="matrix(1 0 0 1 476.4854 867.54)" fill="#010101" font-family="'Lato-Italic'" font-size="18.4908">app/components/rental-tile.js</text> | ||
| <text transform="matrix(1 0 0 1 476.4854 883.3818)" fill="#010101" font-family="'Lato-Italic'" font-size="14.5285">templates/components/rental-tile.hbs</text> |
Contributor
Author
There was a problem hiding this comment.
Please review this file with "Ignore Whitespace" mode turned on.
chancancode
commented
Aug 2, 2019
| For example, a property rentals application would want to save the details of | ||
| a rental when a user publishes it, and so a rental would have a model defining | ||
| its details, perhaps called the _rental_ model. You may also need a _user_ | ||
| model to keep track of who is currently logged in. |
Contributor
Author
There was a problem hiding this comment.
I did add a sentence here to mention a user model, since it's referenced below.
jenweber
approved these changes
Aug 5, 2019
chancancode
force-pushed
the
co-located-templates
branch
from
August 5, 2019 18:56
770c12c to
0cdd97b
Compare
7 of 10 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This partly cover #973, #974 and #975 for the "Getting Started" section.
Since the generator will not generate a class by default, as I make edits for the co-location feature, it forces us into the right direction w.r.t. components-first.