Skip to content

Commit 6f6de05

Browse files
vojtajinajamesdaily
authored andcommitted
docs: fix the "show source" button
Closes angular#4904
1 parent a679bc0 commit 6f6de05

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/src/ngdoc.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -547,10 +547,22 @@ Doc.prototype = {
547547
self = this,
548548
minerrMsg;
549549

550+
var gitTagFromFullVersion = function(version) {
551+
var match = version.match(/-(\w{7})/);
552+
553+
if (match) {
554+
// git sha
555+
return match[1];
556+
}
557+
558+
// git tag
559+
return 'v' + version;
560+
};
561+
550562
if (this.section === 'api') {
551563
dom.tag('a', {
552-
href: 'http://github.com/angular/angular.js/tree/v' +
553-
gruntUtil.getVersion().cdn + '/' + self.file + '#L' + self.line,
564+
href: 'http://github.com/angular/angular.js/tree/' +
565+
gitTagFromFullVersion(gruntUtil.getVersion().full) + '/' + self.file + '#L' + self.line,
554566
class: 'view-source btn btn-action' }, function(dom) {
555567
dom.tag('i', {class:'icon-zoom-in'}, ' ');
556568
dom.text(' View source');

0 commit comments

Comments
 (0)