diff options
| author | Vojta Jina | 2013-11-14 21:33:31 -0800 | 
|---|---|---|
| committer | Vojta Jina | 2013-11-14 21:38:53 -0800 | 
| commit | f4fcaa875766dbe11b82e38839f6ef196bcac6ad (patch) | |
| tree | 2353c871d4b235f454c4fb4202b2ba5582b767bf /docs/src | |
| parent | 40e34a924b629280eb572e957cc8a2cf4f88394c (diff) | |
| download | angular.js-f4fcaa875766dbe11b82e38839f6ef196bcac6ad.tar.bz2 | |
docs: fix the "show source" button
Closes #4904
Diffstat (limited to 'docs/src')
| -rw-r--r-- | docs/src/ngdoc.js | 16 | 
1 files changed, 14 insertions, 2 deletions
| diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js index 6b138835..37f5aeaf 100644 --- a/docs/src/ngdoc.js +++ b/docs/src/ngdoc.js @@ -547,10 +547,22 @@ Doc.prototype = {        self = this,        minerrMsg; +    var gitTagFromFullVersion = function(version) { +      var match = version.match(/-(\w{7})/); + +      if (match) { +        // git sha +        return match[1]; +      } + +      // git tag +      return 'v' + version; +    }; +      if (this.section === 'api') {        dom.tag('a', { -          href: 'http://github.com/angular/angular.js/tree/v' + -            gruntUtil.getVersion().cdn + '/' + self.file + '#L' + self.line, +          href: 'http://github.com/angular/angular.js/tree/' + +            gitTagFromFullVersion(gruntUtil.getVersion().full) + '/' + self.file + '#L' + self.line,            class: 'view-source btn btn-action' }, function(dom) {          dom.tag('i', {class:'icon-zoom-in'}, ' ');          dom.text(' View source'); | 
