@@ -133,6 +133,30 @@ angular
133
133
. then ( filterDocJson ( $sce ) ) ;
134
134
}
135
135
}
136
+ } )
137
+ . when ( '/docs/:module/:class/:method' , {
138
+ controller : 'DocsCtrl' ,
139
+ templateUrl : '/gcloud-node/components/docs/docs.html' ,
140
+ resolve : {
141
+ methods : function ( $q , $http , $route , $sce , $location ) {
142
+ var module = $route . current . params . module ;
143
+ var cl = $route . current . params . class ;
144
+ var method = $route . current . params . method ;
145
+ return $http . get ( '/gcloud-node/json/' + module + '/' + cl + '.json' )
146
+ . then ( filterDocJson ( $sce ) )
147
+ . then ( function ( methods ) {
148
+ var methodExists = methods . some ( function ( methodObj ) {
149
+ return method === methodObj . name ;
150
+ } ) ;
151
+ if ( methodExists ) {
152
+ methods . singleMethod = method ;
153
+ return methods ;
154
+ } else {
155
+ $location . path ( '/docs/' + module + '/' + cl ) ;
156
+ }
157
+ } ) ;
158
+ }
159
+ }
136
160
} ) ;
137
161
} )
138
162
. controller ( 'DocsCtrl' , function ( $location , $scope , $routeParams , methods ) {
@@ -146,6 +170,8 @@ angular
146
170
return doc . toLowerCase ( ) === $routeParams . module ;
147
171
} ;
148
172
173
+ $scope . activeUrl = '/gcloud-node/#' + $location . path ( ) ;
174
+ $scope . singleMethod = methods . singleMethod ;
149
175
$scope . methods = methods ;
150
176
$scope . module = $routeParams . module ;
151
177
$scope . pages = [
0 commit comments