File tree 2 files changed +36
-9
lines changed
docs/site/components/docs
2 files changed +36
-9
lines changed Original file line number Diff line number Diff line change @@ -11,16 +11,43 @@ angular.module('gcloud.docs')
11
11
} ;
12
12
} )
13
13
14
- . directive ( 'docsCodeLink' , function ( $compile ) {
14
+ . directive ( 'docsCodeLink' , function ( ) {
15
15
'use strict' ;
16
16
17
- var GITHUB_BASE = 'https://github.com/GoogleCloudPlatform/gcloud-node/blob/' ;
17
+ var GITHUB_BASE = 'https://github.com/GoogleCloudPlatform/gcloud-node/blob' ;
18
+
19
+ function getFilenameFromConstructor ( constructor ) {
20
+ switch ( constructor ) {
21
+ case 'DatastoreRequest' :
22
+ return 'request.js' ;
23
+ default :
24
+ return 'index.js' ;
25
+ }
26
+ }
18
27
19
28
return {
20
- template : '<a href="' + GITHUB_BASE + '{{version}}/lib/' +
21
- '{{module ? module + \'/\' : \'\'}}{{class}}.js' +
22
- '{{method.lineNumLink}}">' +
23
- '(code on GitHub)' +
24
- '</a>'
29
+ template : '<a href="{{link}}">(code on GitHub)</a>' ,
30
+
31
+ link : function ( $scope ) {
32
+ var method = $scope . method ;
33
+ var module = $scope . module ;
34
+ var version = $scope . version ;
35
+
36
+ var lineNumLink = method . lineNumLink ;
37
+ var fileName = $scope . class + '.js' ;
38
+
39
+ if ( method . data . ctx . hasOwnProperty ( 'constructor' ) ) {
40
+ fileName = getFilenameFromConstructor ( method . data . ctx . constructor ) ;
41
+ }
42
+
43
+ fileName = fileName . toLowerCase ( ) ;
44
+
45
+ $scope . link =
46
+ GITHUB_BASE +
47
+ '/' + version +
48
+ '/lib' +
49
+ ( module ? '/' + module : '' ) +
50
+ '/' + fileName + lineNumLink ;
51
+ }
25
52
} ;
26
53
} ) ;
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ <h3 class="sub-heading">
74
74
ng-hide ="singleMethod && method.name !== singleMethod ">
75
75
< h2 ng-if ="method.name[0].toUpperCase() === method.name[0] ">
76
76
{{method.name}}
77
- < span class =" view -code-link" docs -code-link> </ span >
77
+ < span docs -code-link class =" view -code-link" > </ span >
78
78
</ h2 >
79
79
< h3
80
80
class ="method-heading "
@@ -85,7 +85,7 @@ <h2 ng-if="method.name[0].toUpperCase() === method.name[0]">
85
85
< span > #</ span >
86
86
{{method.name}}
87
87
</ a >
88
- < span class =" view -code-link" docs -code-link> </ span >
88
+ < span docs -code-link class =" view -code-link" > </ span >
89
89
</ h3 >
90
90
< p ng-if ="method.description " ng-bind-html ="method.description "> </ p >
91
91
< div ng-show ="method.name[0].toUpperCase() === method.name[0] "
You can’t perform that action at this time.
0 commit comments