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

Add subroutes #24

Closed
wants to merge 6 commits into from
Closed

Add subroutes #24

wants to merge 6 commits into from

Conversation

sbatson5
Copy link
Contributor

@sbatson5 sbatson5 commented May 15, 2016

WIP PR for adding sub-routes per:
emberjs/guides#1374

@sbatson5 sbatson5 mentioned this pull request May 15, 2016
14 tasks
return this.store.queryRecord('rental', { title: params.title })
},

setupController(controller, model) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

me no like, is this in the prose @toddjordan ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it made the template more readable to access it as rental instead of model but I can revert it, nbd. Is it considered bad practice to use setupController in this way?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbatson5 it's slightly controversial, but I personally think it's unnecessary and unexpected, since you expect the model property to be set with what's returned from the model hook.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in other words, there's some valid use cases for setupController but they're fewer than most people think they are ;)

@toddjordan
Copy link
Contributor

toddjordan commented May 23, 2016

Looks good :-) I was thinking that you could use transitionTo from the index route to redirect users going to '/' to the new rentals route. http://emberjs.com/api/classes/Ember.Route.html#method_transitionTo

Also take a look at the last merge, we've added styling and changed the markup a bit.

@@ -0,0 +1,6 @@
<ul>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd expect this template to reflect the content that currently show in the homepage (using this template instead)

@@ -0,0 +1,5 @@
<ul class="results">
{{#each model as |rentalUnit|}}
{{rental-listing rental=rentalUnit goToShowRoute="goToShowRoute"}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an action to make the component clickable per recommendation here:
emberjs/guides#1443 (comment)

Wondering if this is out of scope for a tutorial on sub-routes. Not sure I want to encourage writing actions this way with closure actions and the route-action helper becoming more prominent. But I don't want to introduce a controller just for the sake of a closure action.

Anyone have thoughts on a faster way to do this that doesn't take much explaining for a beginner's tutorial? Maybe just wrap component in a div and add the action to that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbatson5 You should just wrap rental listing in a {{link-to}} like this:

    {{#link-to "rentals.show" rentalUnit.slug}}
      {{rental-listing rental=rentalUnit}}
    {{/link-to}}

and remove all the "goToShowRoute" stuff

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I was definitely overcomplicating it 😛

@toddjordan
Copy link
Contributor

I created a PR to your branch with what I was talking about: https://github.com/sbatson5/super-rentals/pull/1

@@ -0,0 +1,22 @@
<div class="jumbo">
<a href="#" class="button right up-11">Edit</a>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@toddjordan Do you want an edit subroute added to this tutorial?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question. We've been recently discussing whether to add a form section to the tutorial, and edit would be the logical place to do it. What I think is having the one subroute is fine for now, and when we add forms to the tutorial is when we would add the edit subroute.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So go ahead and remove edit and we'll add it back when we introduce a forms section

@sbatson5
Copy link
Contributor Author

@toddjordan Thanks! Added a PR: toddjordan/ember-cli-tutorial-style#1

@toddjordan
Copy link
Contributor

Cool. I'll merge and re-publish the addon

@toddjordan
Copy link
Contributor

@sbatson5 I updated the super-rentals repo with the updated version of the style addon with your update. you can rebase it into this pr...

Also we'll need to squash commits before merge.

@toddjordan
Copy link
Contributor

also, currently seems some of the tests are failing in this pr

@sbatson5
Copy link
Contributor Author

sbatson5 commented Jun 15, 2016

Rebased and squashed commits. But not sure why Travis is failing. Have any insight @toddjordan ?

Also, I saw your PR I merged into this branch had changes to the vendor/gmap.js. Is that intended? Or should I remove it from this PR?

@sbatson5 sbatson5 changed the title [WIP] Add subroutes Add subroutes Jun 18, 2016
@toddjordan
Copy link
Contributor

toddjordan commented Jul 4, 2016

I pulled down the latest from your branch and tests all pass (we're close!). I did notice this though:

image

Would prefer the text to sit between the picture and the map instead of below it.

@toddjordan
Copy link
Contributor

I was able to correct the listing style issue by updating the ember-cli-tutorial-style addon to be more specific about an anchor style. It seems adding the anchor to the listing for the subroute was picking up an unwanted style.

@toddjordan
Copy link
Contributor

I updated the addon, all you'll need to do to fix is Update the ember-cli-tutorial-style version to 0.0.4!

I think it'll be then be good to go then and we can focus on getting the tutorial guide page out 👍

@sbatson5
Copy link
Contributor Author

sbatson5 commented Jul 7, 2016

@toddjordan Thanks so much for catching that. I saw that styling last time but just thought that npm hadn't updated. Forgot to go back and check it. Will update.

@sbatson5
Copy link
Contributor Author

sbatson5 commented Jul 7, 2016

@toddjordan I updated it to 0.0.4, nombom'ed but am still seeing that odd styling.

@toddjordan
Copy link
Contributor

Hmm I'll recheck tomorrow
On Thu, Jul 7, 2016 at 7:54 PM Scott Batson notifications@github.com
wrote:

@toddjordan https://github.com/toddjordan I updated it to 0.0.4,
nombom'ed but am still seeing that odd styling.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#24 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADcR5w992oaIbw01L6xHy4BZhosSPCtmks5qTZGdgaJpZM4Ie3NH
.

@sbatson5
Copy link
Contributor Author

sbatson5 commented Jul 9, 2016

I'm kind of stumped on this. When I look in node_modules, I can see all the css updates. But if I inspect the stylesheets in Chrome and Firefox, I am not seeing the css changes you or I added to the addon even after nombom'ing and running in incognito. I feel there is something obvious I'm missing.

@toddjordan
Copy link
Contributor

Sorry been on vacation and didn't get to it as planned. Should be able to
help out Sunday or Monday
On Sat, Jul 9, 2016 at 9:23 AM Scott Batson notifications@github.com
wrote:

I'm kind of stumped on this. When I look in node_modules, I can see all
the css updates. But if I inspect the stylesheets in Chrome and Firefox, I
am not seeing the css changes you or I added to the addon even after
nombom'ing and running in incognito. I feel there is something obvious I'm
missing.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#24 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADcR5_3r-2kwZZDIfDFgAQEZ0nX_8Bbqks5qT6C_gaJpZM4Ie3NH
.

@toddjordan
Copy link
Contributor

@sbatson5 How did you update? The vendor css only gets updated when you run the blueprint, which comes from ember install, so your best course to update might be to remove the addon and re-run ember install, so it picks up the newest version and runs the blueprint

@sbatson5
Copy link
Contributor Author

sbatson5 commented Jul 10, 2016

Ah, I was just doing npm install. I thought ember serve would update the vendor file. Good to know! It looks much better now.

@toddjordan
Copy link
Contributor

Awesome. I think this is good to go. I'll hold off on merge until we merge the tutorial guides PR. I'll look that that this week.

@toddjordan
Copy link
Contributor

Created a new branch out of this one for remaining updates. Closing in favor of: #35

@toddjordan toddjordan closed this Aug 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants