Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit fe74939

Browse files
josephperrottmmalerba
authored andcommitted
chore: update the version picker to use the currently running verison. (#482)
1 parent 51e3aab commit fe74939

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/app/shared/version-picker/version-picker.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@ import {docVersions, materialVersion, VersionInfo} from '../version/version';
88
templateUrl: './version-picker.html'
99
})
1010
export class VersionPicker {
11-
12-
_versionRegex = /\d+.\d+.\d+/;
13-
docVersions = docVersions;
14-
11+
/** The currently running versin of Material. */
1512
materialVersion = materialVersion;
13+
/** The possible versions of the doc site. */
14+
docVersions = docVersions;
1615

17-
displayVersion = materialVersion.match(this._versionRegex)[0];
18-
16+
/** Updates the window location if the selected version is a different version. */
1917
onVersionChanged(version: VersionInfo) {
20-
if (version.title.match(this._versionRegex)[0] !== this.displayVersion) {
18+
if (!version.url.startsWith(window.location.href)) {
2119
window.location.assign(version.url);
2220
}
2321
}

src/app/shared/version/version.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ export interface VersionInfo {
1010
}
1111

1212
/** Doc site versions. We update the urls and titles manually */
13-
// TODO(tinayuangao): Update the title with actual versions
1413
export const docVersions: VersionInfo[] = [
1514
{
1615
url: 'https://v5.material.angular.io/',
1716
title: '5.2.5'
1817
},
1918
{
2019
url: `https://material.angular.io/`,
21-
title: '6.3.2'
20+
title: materialVersion
2221
}
2322
];

0 commit comments

Comments
 (0)