Skip to content

Commit 518a174

Browse files
docs: add language switcher directive + add Ruby
fixes googleapis#557 fixes googleapis#558
1 parent 8b3f0cf commit 518a174

File tree

6 files changed

+42
-18
lines changed

6 files changed

+42
-18
lines changed

docs/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<script src="site/components/docs/docs-values.js"></script>
3939
<script src="site/components/authorization/authorization.js"></script>
4040
<script src="site/components/faq/faq.js"></script>
41+
<script src="site/components/language-switcher/language-switcher-directive.js"></script>
4142
<script src="site/components/subpage/subpage-directive.js"></script>
4243
<script src="site/components/header/header-directive.js"></script>
4344
<script src="site/components/troubleshooting/troubleshooting.js"></script>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
angular
2+
.module('gcloud.language-switcher', [])
3+
.directive('languageSwitcher', function() {
4+
'use strict';
5+
6+
return {
7+
templateUrl: 'site/components/language-switcher/language-switcher.html',
8+
transclude: true,
9+
10+
controller: function($scope) {
11+
$scope.showNavDropdown = false;
12+
}
13+
};
14+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<nav class="main-nav" ng-class="{ open: showNavDropdown }">
2+
<div class="nav-current" ng-click="showNavDropdown = !showNavDropdown">Node.js</div>
3+
<ul class="menu">
4+
<li>
5+
<a href="#" title="gcloud-node Documentation">
6+
<img src="site/img/icon-lang-nodejs-white.svg" alt="gcloud-node" class="menu-icon">
7+
Node.js
8+
</a>
9+
</li>
10+
<li>
11+
<a href="https://googlecloudplatform.github.io/gcloud-python" title="gcloud-python Documentation">
12+
<img src="site/img/icon-lang-python.svg" alt="gcloud-python" class="menu-icon">
13+
Python
14+
</a>
15+
</li>
16+
<li>
17+
<a href="https://googlecloudplatform.github.io/gcloud-ruby" title="gcloud-ruby Documentation">
18+
<img src="site/img/icon-lang-ruby.svg" alt="gcloud-ruby" class="menu-icon">
19+
Ruby
20+
</a>
21+
</li>
22+
</ul>
23+
</nav>

docs/site/components/subpage/subpage.html

+1-17
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,7 @@ <h1 class="logo">
66
<span class="gcloud">gcloud</span>
77
</a>
88
</h1>
9-
<nav class="main-nav" ng-class="{ open: showNavDropdown }">
10-
<div class="nav-current" ng-click="showNavDropdown = !showNavDropdown">Node.js</div>
11-
<ul class="menu">
12-
<li>
13-
<a href="#" title="Node.js docs page">
14-
<img src="site/img/icon-lang-nodejs-white.svg" alt="Node.js icon" class="menu-icon">
15-
Node.js
16-
</a>
17-
</li>
18-
<li>
19-
<a href="https://googlecloudplatform.github.io/gcloud-python" title="Python docs page">
20-
<img src="site/img/icon-lang-python.svg" alt="Python icon" class="menu-icon">
21-
Python
22-
</a>
23-
</li>
24-
</ul>
25-
</nav>
9+
<div language-switcher></div>
2610
</header>
2711

2812
<header ng-if="headerTemplateUrl" ng-include="headerTemplateUrl"></header>

docs/site/home.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<header class="page-header" role="banner">
22
<h1 class="logo"><img src="site/img/logo-full.svg" alt="Google Cloud Platform" /></h1>
3+
<div language-switcher></div>
34
</header><!-- end of .page-header -->
45

56
<article class="main" role="main">

docs/site/home.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ angular
44
'gcloud.authorization',
55
'gcloud.docs',
66
'gcloud.faq',
7+
'gcloud.language-switcher',
78
'gcloud.troubleshooting',
89
'config',
910
'hljs'
@@ -20,7 +21,7 @@ angular
2021
controller: 'HomeCtrl'
2122
});
2223
})
23-
.controller('HomeCtrl', function() {
24+
.controller('HomeCtrl', function($scope) {
2425
'use strict';
2526
})
2627
.run(function($rootScope, $location, versions) {

0 commit comments

Comments
 (0)