Skip to content

Commit 5d9c438

Browse files
docs: breadcrumbs: irony: use proper module casing
1 parent 70a4c3b commit 5d9c438

2 files changed

Lines changed: 26 additions & 8 deletions

File tree

docs/site/components/docs/docs-services.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,13 @@ angular.module('gcloud.docs')
3737
return moduleA.title === 'gcloud' ? -1 : moduleA.title > moduleB.title;
3838
});
3939
};
40+
})
41+
42+
.factory('getModule', function(pages) {
43+
'use strict';
44+
45+
return function(moduleName) {
46+
moduleName = moduleName.toLowerCase();
47+
return pages[moduleName];
48+
};
4049
});

docs/site/components/docs/docs.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ angular
306306
});
307307
})
308308

309-
.controller('DocsCtrl', function($location, $scope, $routeParams, methods, $http, versions) {
309+
.controller('DocsCtrl', function($location, $scope, $routeParams, methods, $http, versions, getModule) {
310310
'use strict';
311311

312312
$scope.isActiveUrl = function(url) {
@@ -333,14 +333,23 @@ angular
333333
}
334334

335335
// Set the page title (used in the header).
336-
var title = $routeParams.module;
337-
if ($routeParams.class) {
338-
title += ' » ' + $routeParams.class;
336+
var pageTitle = [];
337+
338+
var moduleName = $routeParams.module;
339+
if (moduleName) {
340+
pageTitle.push(getModule($routeParams.module).title);
341+
}
342+
343+
var className = $routeParams.class;
344+
if (className) {
345+
pageTitle.push(className[0].toUpperCase() + className.substr(1));
346+
}
347+
348+
if (pageTitle.length > 0) {
349+
$scope.pageTitle = pageTitle.join(' » ');
350+
} else {
351+
$scope.pageTitle = 'Node.js';
339352
}
340-
// Capitalize words.
341-
$scope.pageTitle = (title || 'Node.js').replace(/(?:^|\s)\S/g, function(a) {
342-
return a.toUpperCase();
343-
});
344353

345354
$scope.showReference = true;
346355
$scope.activeUrl = '#' + $location.path();

0 commit comments

Comments
 (0)