tmeasday / meteor-router

MIT License
366 stars 76 forks source link

Allow nested routes / more than one use of {{renderPage}} #101

Closed mizzao closed 11 years ago

mizzao commented 11 years ago

One rather restricting limitation of Router right now is that the {{renderPage}} helper can only be placed once on a page. So basically you have to decide what part of your page is mostly static (or at least can't be changed by the route) and which part will render according to the route.

That is good for most pages, but let's say I have the following structure:

/foo/bar /foo/baz /admin/task1 /admin/task2

We can think of foo as the root or main site, and it has a bunch of routes that correspond to different sections. However, perhaps we also want to build routes for the administration section of the site, and these can't use the same rendering layout as the rest of the site. It doesn't seem like there's a way to do this efficiently with router right now, especially if you want to use the routes inside both sections, because of the single {{renderPage}} helper. Is this correct or am I not seeing something?

I'm currently wondering about how to implement an admin section of a meteor app that can also use the meteor code. I think that a good implementation of routes would be one way to do that, and I would definitely contribute, but there may be other ways as well.

tmeasday commented 11 years ago

Hey @mizzao . I'm working on new router with @cmather right now that will explicitly support layouts (which is what you want here I think).

ericpedia commented 11 years ago

@tmeasday are you talking about https://github.com/EventedMind/iron-router? Do you recommend that over this one?

mizzao commented 11 years ago

@ericpedia this post is rather old and out of date. However, you should definitely be using iron router because this router has been effectively deprecated in favor of it.

Also, although Iron Router supports a page layout, the last time I checked it doesn't actually support more than one, so it does not look like this feature is explicitly supported.

cmather commented 11 years ago

@mizzao, multiple layouts have been supported for a while on dev. Hoping to get it released this week but the dev branch is pretty stable.

EDIT: Sorry I may have misunderstood because I didn't see the link. Route by route layouts are supported. But only one layout on the page at a given time.