diff options
| author | Matias Niemelä | 2013-08-15 01:09:06 -0400 | 
|---|---|---|
| committer | Igor Minar | 2013-08-23 07:37:51 -0700 | 
| commit | 74ae3edf8614ea8a97580033db0fd145d5260b62 (patch) | |
| tree | cc709e3ec941f93e66b4c8f0a298d7a78f8bb7b6 /docs/src/templates/js/docs.js | |
| parent | 699f86c535cbc01589d60ea1dc48114a93cd4f19 (diff) | |
| download | angular.js-74ae3edf8614ea8a97580033db0fd145d5260b62.tar.bz2 | |
chore(ngdocs): fix the version jumper
correct the ordering and make gen-docs prepare the list of versions
during the build process
Diffstat (limited to 'docs/src/templates/js/docs.js')
| -rw-r--r-- | docs/src/templates/js/docs.js | 58 | 
1 files changed, 4 insertions, 54 deletions
| diff --git a/docs/src/templates/js/docs.js b/docs/src/templates/js/docs.js index 1deea88e..9b38313b 100644 --- a/docs/src/templates/js/docs.js +++ b/docs/src/templates/js/docs.js @@ -5,60 +5,10 @@ var docsApp = {  };  docsApp.controller.DocsVersionsCtrl = ['$scope', '$window', 'NG_VERSIONS', 'NG_VERSION', function($scope, $window, NG_VERSIONS, NG_VERSION) { -  $scope.versions = expandVersions(NG_VERSIONS); -  $scope.version  = ($scope.version || NG_VERSION).match(/^([\d\.]+\d+\S+)/)[1]; //match only the number - -  $scope.jumpToDocsVersion = function(value) { -    var isLastStable, -        version, -        versions = $scope.versions; -    for(var i=versions.length-1;i>=0;i--) { -      var v = versions[i]; -      if(v.version == value) { -        var next = versions[i - 1]; -        isLastStable = v.stable && (!next || next && !next.stable); -        version = v; -        break; -      } -    }; - -    if(version && version.version >= '1.0.0') { -      //the older versions have a different path to the docs within their repo directory -      var docsPath = version.version < '1.0.2' ? 'docs-' + version.version : 'docs'; - -      //the last stable version should redirect to docs.angularjs.org instead of code.angularjs.org -      var url = 'http://' + -                  (isLastStable ? -                    'docs.angularjs.org' : -                    'code.angularjs.org/' + version.version + '/' + docsPath); - -      $window.location = url; -    } -  }; - -  function expandVersions(angularVersions) { -    var unstableVersionStart = 0; -    angularVersions.forEach(function(version) { -      var split = version.split('.'); -      unstableVersionStart = split[1] % 2 == 1 ? -                        Math.max(unstableVersionStart, parseInt(split[0] + '' + split[1])) : -                        unstableVersionStart; -    }); - -    var versions = []; -    for(var i=angularVersions.length-1;i>=0;i--) { -      var version = angularVersions[i]; -      var split = version.split('.'); -      var stable = parseInt(split[0] + '' + split[1]) < unstableVersionStart; -      versions.push({ -        version : version, -        stable : stable, -        title : 'AngularJS - v' + version, -        group : (stable ? 'Stable' : 'Unstable') -      }); -    }; - -    return versions; +  $scope.docs_versions = NG_VERSIONS; +  $scope.docs_version  = NG_VERSIONS[0]; +  $scope.jumpToDocsVersion = function(version) { +    $window.location = version.url;    };  }]; | 
