-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Clean up Ember router map #5340
Conversation
jaswilli
commented
May 25, 2015
- Switch resources to routes.
- No longer nest "settings" routes so the router reflects the way the templates are rendered.
- Remove renderTemplate override from settings routes.
- Remove unneeded routes, controllers, and views.
- Adjust users page so that infinite scroll loading of users works and markup remains the same for Zelda styling.
|
||
needs: ['feature'], | ||
|
||
showGeneral: Ember.computed('session.user.name', function () { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
A lot of this looks good, I think it will make another routing task I was struggling on, a lot easier but I noticed you removed the redirect test for the about page and the redirect route. Consequently if I navigate to /ghost/settings/about I now get a 404 error which doesn't seem desirable. |
I'm not sure why you'd want a redirect to that route. It's a protected URL inside a single page app, so links inside the app should be updated and nothing external is linking to it. |
I'm not sure what you mean by nothing external linking to it, how do you know that, you are guessing I think there. What makes you think I/somebody doesn't have a link to myblog.com/ghost/settings/about... You can argue whether the about page has enough significance to warrant a redirect but when we moved debug tools to labs we set up a redirect and so for consistency alone I would think we need a redirect here but if other people disagree that's cool with me, how long we keep the redirect is another point to argue perhaps - maybe the debug redirect can go now? |
Covered in the meeting so no need to go into it, except that for the record, I totally did argue against the Debug redirect 😛 , but since it was only a URL (never linked from the menu) it was argued that a redirect made sense, and I was convinced 😄 I'd be up for removing the Debug redirect unless there's third party documentation out there still referring people to it, in which case we may as well keep it... |
I would say dump it, it's been in Labs for long enough and is clearly visible in the new nav menu :) |
Updated--now removes the legacy Debug redirect. |
No Issue - Switch resources to routes. - No longer nest "settings" routes so the router reflects the way the templates are rendered. - Remove renderTemplate override from settings routes. - Remove unneeded routes, controllers, and views. - Adjust users page so that infinite scroll loading of users works and markup remains the same for Zelda styling.
This is great. Nice cleanup, and I dig shifting our paradigm to |
We use the export-at-the-end structure across both node and ember at the moment - so the code base is consistent. I agree that it can be a bit verbose, but consistency is king. There are other ways to do this, which includes declaring the exports inline, which I believe is confusing in larger files, and also declaring first - I know this works in node not sure if it does in ember-land? Either way - if there is a sense that this should be changed, it should probably be discussed in an issue or on slack and decided upon for certain, and then rolled out across the codebase. |
I thought the changeover had already begun - I've seen a few PRs getting merged in this style without comment. I believe putting the export on the declaration improves readability, particularly in files with a lot of code happening in the declaration. Making a variable there begs the question of "Do we do more things to this than just extend it?" forcing people to scroll through a bunch of code just to double check that the file puts out what they think it should anyways. Nice to have that immediately in most all of our files, where nothing else happens. One less cognitive switch / layer of indirection, is what I'm trying to say. // foo.js Scroll!
var Foo = Bar.extend({
//50 lines of code
//..
//....
});
export default Foo;
// foo.js No scrolling needed!
export default Bar.extend({
//50 lines of code
//..
//....
}); |
There are a few reasons why I've started making this switch when I touch files in the ember app:
var PostsPostController = Ember.Controller.extend();
export default PostsPostController; The above implies that the name of the variable may be important.
|
no issue - drops the `var Foo = Ember.Thing.extend({}); export default Foo;` syntax in favour of exporting directly, eg: `export default Ember.Thing.extend({})` - discussion on this change [here](TryGhost#5340 (comment)) and [here](TryGhost#5694 (diff))