Automatic deploy to GitHub Pages: 681a3031b5

This commit is contained in:
Travis CI 2017-08-07 11:45:21 +00:00
parent 31cb55e2ea
commit 88f211dcd8
1 changed files with 18 additions and 2 deletions

View File

@ -34,9 +34,9 @@
</div>
<ul class="list-group">
<a class="list-group-item" ng-repeat="version in data | orderBy"
<a class="list-group-item" ng-repeat="version in data | orderBy:versionOrder:true"
href="./{{version}}/index.html">
{{version}}
{{normalizeVersion(version)}}
</a>
</ul>
</article>
@ -54,6 +54,22 @@
.controller('docVersions', function ($scope, $http) {
$scope.loading = true;
$scope.normalizeVersion = function(v) {
return v.replace(/^v/, '');
};
$scope.versionOrder = function(v) {
if (v === 'master') { return Infinity; }
if (v === 'current') { return Number.MAX_VALUE; }
return $scope.normalizeVersion(v)
.split('.')
.reverse()
.reduce(function(acc, val, index) {
return acc + (val * Math.pow(100, index));
}, 0);
}
$http.get('./versions.json')
.success(function (data) {
$scope.data = data;