Skip to content

Commit e6287cc

Browse files
committed
chore: update the version picker to use the currently running verison. (angular#482)
1 parent 7671953 commit e6287cc

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
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: 2 additions & 3 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.4'
1817
},
1918
{
20-
url: `http://material.angular.io`,
21-
title: '6.0.0'
19+
url: `https://material.angular.io/`,
20+
title: materialVersion
2221
}
2322
];

0 commit comments

Comments
 (0)