Skip to content

Global navigation on-state gets lost when navigating to a settings page.  #2394

@justinscherer

Description

@justinscherer

Expected behaviour

Global navigation item "Settings" should be highlighted in yellow when I go to the a settings page

Actual behaviour

screen shot 2018-01-10 at 11 02 12 am

Steps to reproduce the behaviour/error

  • Click on any link in the settings-menu, see the settings-item turn grey.

Hints on fixing this issue:

Hint 1 💡 : The navigation-items turn yellow when the active class is set to the element. The html for the mode-bar is here:
https://github.com/ushahidi/platform-client/blob/develop/app/common/directives/mode-bar/mode-bar.html#L42

Hint 2 💡 : ui-sref-active="active" adds the class 'active' to the <li> element, but only for the route /settings. Not the subroutes like "/settings/surveys".

Hint 3 💡 : $state.includes('settings') gives us the information we want instead, this could be combined with ng-class to add the class 'active'. Check for example here: https://github.com/ushahidi/platform-client/blob/develop/app/common/directives/mode-bar/mode-bar.html#L1

Hint 4 💡 : $state needs to be injected to the directive and added to the $scope-variable in order to use it in the template:
https://github.com/ushahidi/platform-client/blob/develop/app/common/directives/mode-bar/mode-bar.directive.js#L9
https://github.com/ushahidi/platform-client/blob/develop/app/common/directives/mode-bar/mode-bar.directive.js#L18
https://github.com/ushahidi/platform-client/blob/develop/app/common/directives/mode-bar/mode-bar.directive.js#L31

Aha! Link: https://ushahiditeam.aha.io/features/PROD-451

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions