This repository has been archived by the owner on Nov 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 78
Use router infos for crumb generation to support resetNamespace #64
Closed
ivanvanderbyl
wants to merge
9
commits into
poteto:develop
from
ivanvanderbyl:use-router-infos-for-crumb-generation
Closed
Use router infos for crumb generation to support resetNamespace #64
ivanvanderbyl
wants to merge
9
commits into
poteto:develop
from
ivanvanderbyl:use-router-infos-for-crumb-generation
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This allows customisation of first and last crumb, for specific cases where you might want to do things differently, i.e. make the last route a dropdown menu like on Google Drive.
☔ The latest upstream changes (presumably #63) made this pull request unmergeable. Please resolve the merge conflicts. |
# Conflicts: # addon/components/bread-crumbs.js
Refactored to use handler infos Refactored to use handler infos for path generation Refactored to declare index route only if entered Fixed default title and reverted to using index on tail only First route should not be index Bar route should be linkable
ivanvanderbyl
force-pushed
the
use-router-infos-for-crumb-generation
branch
from
February 24, 2016 20:13
62857ad
to
c318be0
Compare
I fixed those merge conflicts |
@ivanvanderbyl could you rebase this against |
@ivanvanderbyl closing this PR to avoid future confusion about branches. Can you please reopen against |
This PR is quite old... Is resetNamespace supported by the plugin? |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is potentially a breaking change.
Previously, using
resetNamespace
would break the crumb chain because we only checked thecurrentRouteName
for tokens to generate crumbs from. ThecurrentRouteName
doesn't include anything before aresetNamespace
.To fix this I've used the router's
handlerInfos
to build a list of all active route names, then removed any which weren't part of thecurrentPath
.While implementing this change it occurred to me that the current implementation is possibly incorrect, to explain this let's assume we have the following route paths active:
[
foo
,foo.bar
,foo.bar.baz
]In the current implementation is would look for an
index
route at the start by attempting a lookup onfoo.index
, if it's implemented. So the lookup paths are: [foo.index
,foo.bar
,foo.bar.baz
]([see tests]%28https://github.com/poteto/ember-crumbly/blob/develop/tests/acceptance/integration-test.js#L148%29). This behaviour is unexpected becausefoo.index
isn't active, butfoo
is.I believe the correct lookup should be: [
foo
,foo.bar
,foo.bar.baz.index
], because we're in the index route.Was there a design decision around this that I've missed completely?
This PR also includes the
isTail
andisHead
functionality from #51