diff --git a/docs/app/src/versions.js b/docs/app/src/versions.js index 701f41d3..186a1555 100644 --- a/docs/app/src/versions.js +++ b/docs/app/src/versions.js @@ -1,14 +1,30 @@ +"use strict"; + angular.module('versions', []) .controller('DocsVersionsCtrl', ['$scope', '$location', '$window', 'NG_VERSIONS', function($scope, $location, $window, NG_VERSIONS) { - $scope.docs_versions = NG_VERSIONS; $scope.docs_version = NG_VERSIONS[0]; + for(var i=0, minor = NaN; i < NG_VERSIONS.length; i++) { + var version = NG_VERSIONS[i]; + // NaN will give false here + if (minor <= version.minor) { + continue; + } + version.isLatest = true; + minor = version.minor; + } + + $scope.docs_versions = NG_VERSIONS; + $scope.getGroupName = function(v) { + return v.isLatest ? 'Latest' : (v.isStable ? 'Stable' : 'Unstable'); + }; + $scope.jumpToDocsVersion = function(version) { var currentPagePath = $location.path(); // TODO: We need to do some munging of the path for different versions of the API... - + $window.location = version.docsUrl + currentPagePath; }; diff --git a/docs/config/templates/indexPage.template.html b/docs/config/templates/indexPage.template.html index b5ec7122..42f79ad4 100644 --- a/docs/config/templates/indexPage.template.html +++ b/docs/config/templates/indexPage.template.html @@ -175,7 +175,7 @@
-