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

Specify createTrailingSlashRoutes as an instance property when extending from Backbone.Subroute #56

Open
aeksco opened this issue May 19, 2015 · 0 comments

Comments

@aeksco
Copy link
Member

aeksco commented May 19, 2015

I'm in a situation where I have the following:

class App.Routers.SuperRouter extends Backbone.SubRoute
  createTrailingSlashRoutes: true
  ...

from which I extend:

class App.Routers.Books extends App.Routers.SuperRouter
  ...

I've noticed that the createTrailingSlashRoutes: true instance property is applied to neither App.Routers.SuperRouter nor the routers extending from it. This appears to be the result of backbone.subroute.js line 38:

this.createTrailingSlashRoutes = options && options.createTrailingSlashRoutes;

indicating that the createTrailingSlashRoutes option must be supplied to the router when it's instantiated. It looks like this would be a simple change:

this.createTrailingSlashRoutes ||= options && options.createTrailingSlashRoutes;

and I would like to know wether this is worth doing before I go through the process of throwing together a PR. For the time being I am supplying my own constructor:

class App.Routers.SuperRouter extends Backbone.SubRoute
  constructor: (route, opts = {}) ->
    super(route, _.extend opts, { createTrailingSlashRoutes: true })
  ...

Let me know your thoughts when you've got a moment - thanks!

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

No branches or pull requests

1 participant