mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
use constructor bound methods for nav group
This commit is contained in:
parent
24208197e8
commit
5948ecce16
@ -14,15 +14,20 @@ class NavExpandableGroup extends Component {
|
||||
// Extract a list of paths from the route params and store them for later. This creates
|
||||
// an array of url paths associated with any NavItem component rendered by this component.
|
||||
this.navItemPaths = routes.map(({ path }) => path);
|
||||
|
||||
this.isActiveGroup = this.isActiveGroup.bind(this);
|
||||
this.isActivePath = this.isActivePath.bind(this);
|
||||
}
|
||||
|
||||
isActiveGroup = () => this.navItemPaths.some(this.isActivePath);
|
||||
isActiveGroup () {
|
||||
return this.navItemPaths.some(this.isActivePath);
|
||||
}
|
||||
|
||||
isActivePath = (path) => {
|
||||
isActivePath (path) {
|
||||
const { history } = this.props;
|
||||
|
||||
return history.location.pathname.startsWith(path);
|
||||
};
|
||||
}
|
||||
|
||||
render () {
|
||||
const { groupId, groupTitle, routes } = this.props;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user