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 support for optional route parameters #19

Open
shiftyp opened this issue Dec 13, 2013 · 3 comments
Open

Add support for optional route parameters #19

shiftyp opened this issue Dec 13, 2013 · 3 comments

Comments

@shiftyp
Copy link

shiftyp commented Dec 13, 2013

Backbone has a syntax for optional parts of a route, for example: foo(/:bar) will match foo and foo/baz. Right now the Giraffe.Router#_reverseHash function doesn't support these parameters.

@ryanatkn
Copy link
Contributor

Sorry for not documenting this - we were aware of the limitation when writing the function but didn't have the time to do it correctly. A PR would be welcome; I'll try to find the time to look into it after the holidays.

@bobthecow
Copy link
Contributor

👍

@ryanatkn
Copy link
Contributor

ryanatkn commented Dec 5, 2014

This is a partial fix. Optional params, like '/foo(/:bar)', should now work, but optional static paths, like '/foo(/bar)', remain broken for Router#isCaused. Fixing it looks like it requires some significant refactoring - a PR would be welcome if you find yourself needing it. Router#cause can't be fixed without manually specifying whether or not to include each optional part, which doesn't seem feasible.

@ryanatkn ryanatkn reopened this Dec 19, 2014
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

3 participants