tbranyen / backbone.routemanager

Better route management for Backbone.js projects.
MIT License
111 stars 10 forks source link

Fix nested routers `routes` #4

Closed SBoudrias closed 11 years ago

SBoudrias commented 11 years ago

Before, routes names wheren't mapped correctly with their prefix, giving:

"" -> "main/",
":id" -> "main//:id"
"test" -> "main//test"

Now they're mapped correctly to usable routes by backbone routers.

"" -> "main",
":id" -> "main/:id"
"test" -> "main/test"
tbranyen commented 11 years ago

I believe this is fixed in the wip branch.

SBoudrias commented 11 years ago

Just checked this out, and I have the same issue on the wip branch.

It's because prefix is formatted here: https://github.com/tbranyen/backbone.routemanager/blob/master/backbone.routemanager.js#L52-L58

But, you re-add the / here: https://github.com/tbranyen/backbone.routemanager/blob/master/backbone.routemanager.js#L76

And, routes wouldn't need a ending / if the route is an empty string.

SBoudrias commented 11 years ago

Pushed similar, but cleaner fix here #6