Automatic state handling for ERXNavigation #752
Merged
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.
Adds automatic handling of navigation state to ERXNavigation. To achieve this, we store each menu item's navigation state string in a dictionary ("NavigationMap"), using its relative URI as the key. In this way we can reliably determine the navigation state, when a request is due to the user clicking a navigation link. (There may be a more efficient/elegant way to achieve the same thing by using the element IDs to retrieve the correct ERXNavigationItem, but I couldn't figure out how to make it work. Any hints most welcome!)
Obviously this will not work when a user clicks somewhere outside of the navigation menu. For the case of D2W, we can apply a simple heuristic that should be "good enough" for the majority of such cases (e.g. a click on a "Find" button on a query page). See ERDDelayedNavigationStateAssignment for details on how this is handled.
For non-D2W applications, you should retrieve the navigation state via ERXNavigationManager.manager().navigationStateFromMap() and apply it as you see fit, e.g. in Session.awake().
Also adds a defaultChild attribute to navigation elements. Instead of specifying the same action as on one of the children, one can now simply specify a defaultChild to achieve the same result.