Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for co-located templates (Part 1: "Getting Started") #977

Merged
merged 2 commits into from Aug 6, 2019

Conversation

@chancancode
Copy link

commented Aug 2, 2019

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.

@chancancode chancancode changed the base branch from master to octane Aug 2, 2019

@chancancode chancancode force-pushed the co-located-templates branch from 8e247cd to 770c12c Aug 2, 2019

* It loads a model.
* It renders a template, which has access to the model.

## Models

This comment has been minimized.

Copy link
@chancancode

chancancode Aug 2, 2019

Author

This is mostly just moved up from below.

code associated with them, allowing you to add _behavior_, such as responding
to a user clicking on your component.

We will cover these advanced component features in a later chapter.

## Lifecycle Hooks

This comment has been minimized.

Copy link
@chancancode

chancancode Aug 2, 2019

Author

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 chancancode requested review from jenweber and tomdale 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}},

This comment has been minimized.

Copy link
@chancancode

chancancode Aug 2, 2019

Author

This is where my desire for @model came up – it would be nicer if we could consistently introduce everything with @args and avoid this.* until we have a need to teach adding a class for components. Having model exposed as this.model but not @model breaks that flow.

cc @locks @rwjblue @wycats

<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>

This comment has been minimized.

Copy link
@chancancode

chancancode Aug 2, 2019

Author

Please review this file with "Ignore Whitespace" mode turned on.

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.

This comment has been minimized.

Copy link
@chancancode

chancancode Aug 2, 2019

Author

I did add a sentence here to mention a user model, since it's referenced below.

@chancancode chancancode force-pushed the co-located-templates branch from 770c12c to 0cdd97b Aug 5, 2019

@amyrlam amyrlam referenced this pull request Aug 6, 2019

Merged

The Ember Times No. 110 - August 9th 2019 #220

7 of 10 tasks complete

@jenweber jenweber merged commit 11fb4e2 into octane Aug 6, 2019

5 of 7 checks passed

Header rules - ember-guides No header rules processed
Details
Pages changed - ember-guides 3664 new files uploaded
Details
Mixed content - ember-guides No mixed content detected
Details
Redirect rules - ember-guides 2 redirect rules processed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
netlify/ember-guides/deploy-preview Deploy preview ready!
Details
percy/guides-app Visual review approved by Jen Weber
Details

@sivakumar-kailasam sivakumar-kailasam deleted the co-located-templates branch Aug 13, 2019

@jenweber jenweber added the Octane label Aug 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.