added branches matches regex and trans for createBranch

This commit is contained in:
Florian Scholdei
2019-03-29 10:22:54 +01:00
parent 07948b51a8
commit 68d17f8ad8
4 changed files with 23 additions and 5 deletions

View File

@@ -75,7 +75,13 @@ class RepositoryRoot extends React.Component<Props> {
return this.stripEndingSlash(this.props.match.url);
};
matches = (route: any) => {
matchesBranches = (route: any) => {
const url = this.matchedUrl();
const regex = new RegExp(`${url}?/?/branch?.*`);
return route.location.pathname.match(regex);
};
matchesChangesets = (route: any) => {
const url = this.matchedUrl();
const regex = new RegExp(`${url}(/branch)?/?[^/]*/changesets?.*`);
return route.location.pathname.match(regex);
@@ -228,6 +234,7 @@ class RepositoryRoot extends React.Component<Props> {
to={`${url}/branches/`}
icon="fas fa-code-branch"
label={t("repositoryRoot.menu.branchesNavLink")}
activeWhenMatch={this.matchesBranches}
activeOnlyWhenExact={false}
/>
<RepositoryNavLink
@@ -236,7 +243,7 @@ class RepositoryRoot extends React.Component<Props> {
to={`${url}/changesets/`}
icon="fas fa-exchange-alt"
label={t("repositoryRoot.menu.historyNavLink")}
activeWhenMatch={this.matches}
activeWhenMatch={this.matchesChangesets}
activeOnlyWhenExact={false}
/>
<RepositoryNavLink