Skip to content

Commit 9dfa949

Browse files
t-jindaipetebacondarwin
authored andcommitted
chore(version-info): modify versioning for < v1.0.2
Angular v1.0.1 and earlier did not have valid versions and had a different docs url format, so you can not access their api docs from the version drop-down. Closes angular#11132
1 parent a057e08 commit 9dfa949

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

docs/app/src/versions.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ angular.module('versions', [])
2121
};
2222

2323
$scope.jumpToDocsVersion = function(version) {
24-
var currentPagePath = $location.path().replace(/\/$/, '');
25-
26-
// TODO: We need to do some munging of the path for different versions of the API...
27-
28-
29-
$window.location = version.docsUrl + currentPagePath;
24+
var currentPagePath = $location.path().replace(/\/$/, ''),
25+
url = '';
26+
if (version.isOldDocsUrl) {
27+
url = version.docsUrl;
28+
}else{
29+
url = version.docsUrl + currentPagePath;
30+
}
31+
$window.location = url;
3032
};
3133
}]);

lib/versions/version-info.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,16 @@ var getPreviousVersions = function() {
110110
})
111111
.filter()
112112
.map(function(version) {
113+
// angular.js didn't follow semantic version until 1.20rc1
114+
if ((version.major === 1 && version.minor === 0 && version.prerelease.length > 0) || (version.major === 1 && version.minor === 2 && version.prerelease[0] === 'rc1')) {
115+
version.version = [version.major, version.minor, version.patch].join('.') + version.prerelease.join('');
116+
version.raw = 'v' + version.version;
117+
}
113118
version.docsUrl = 'http://code.angularjs.org/' + version.version + '/docs';
114119
// Versions before 1.0.2 had a different docs folder name
115-
if (version.major < 1 || (version.major === 1 && version.minor === 0 && version.dot < 2)) {
120+
if (version.major < 1 || (version.major === 1 && version.minor === 0 && version.patch < 2)) {
116121
version.docsUrl += '-' + version.version;
122+
version.isOldDocsUrl = true;
117123
}
118124
return version;
119125
})

0 commit comments

Comments
 (0)