Skip to content

Commit

Permalink
Merge pull request #586 from stephenplusplus/breadcrumbs-attempt-2
Browse files Browse the repository at this point in the history
Breadcrumbs attempt 2
  • Loading branch information
stephenplusplus committed May 12, 2015
2 parents c1f135f + 5d9c438 commit 11e808b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
9 changes: 9 additions & 0 deletions docs/site/components/docs/docs-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,13 @@ angular.module('gcloud.docs')
return moduleA.title === 'gcloud' ? -1 : moduleA.title > moduleB.title;
});
};
})

.factory('getModule', function(pages) {
'use strict';

return function(moduleName) {
moduleName = moduleName.toLowerCase();
return pages[moduleName];
};
});
2 changes: 1 addition & 1 deletion docs/site/components/docs/docs.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script id="docs-header.html" type="text/ng-template">
<header header title="Node.js">
<header header title="{{pageTitle}}">
<div class="row row--right">
<div class="col margin-vertical">
<a href="https://github.com/GoogleCloudPlatform/gcloud-node/issues/new"
Expand Down
22 changes: 20 additions & 2 deletions docs/site/components/docs/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ angular
});
})

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

$scope.isActiveUrl = function(url) {
Expand All @@ -332,7 +332,25 @@ angular
});
}

$scope.pageTitle = 'Node.js';
// Set the page title (used in the header).
var pageTitle = [];

var moduleName = $routeParams.module;
if (moduleName) {
pageTitle.push(getModule($routeParams.module).title);
}

var className = $routeParams.class;
if (className) {
pageTitle.push(className[0].toUpperCase() + className.substr(1));
}

if (pageTitle.length > 0) {
$scope.pageTitle = pageTitle.join(' » ');
} else {
$scope.pageTitle = 'Node.js';
}

$scope.showReference = true;
$scope.activeUrl = '#' + $location.path();
$scope.singleMethod = methods.singleMethod;
Expand Down

0 comments on commit 11e808b

Please sign in to comment.