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

Automatic state handling for ERXNavigation #752

Merged

Conversation

fbarthez
Copy link
Contributor

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.

…eve 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.

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).
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.
…e for "Home", for which the pageConfiguration is null. Add functional tests.
@avendasora avendasora merged commit e60d618 into wocommunity:master Jun 26, 2016
@fbarthez fbarthez deleted the pr/ERXNavigation-automaticStateHandling branch September 16, 2016 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants