Skip to content

Commit 05eaa6b

Browse files
chore(docs): add button to link to stable docs
Closes angular#7513
1 parent ff791c9 commit 05eaa6b

File tree

3 files changed

+41
-35
lines changed

3 files changed

+41
-35
lines changed

docs/app/assets/css/docs.css

+3-16
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,8 @@ code.highlighted {
218218

219219
.picker {
220220
position: relative;
221-
width: auto;
221+
width: 100%;
222222
display: inline-block;
223-
margin: 0 0 2px 1.2%;
224223
overflow: hidden;
225224
border: 1px solid #e5e5e5;
226225
-webkit-border-radius: 4px;
@@ -243,8 +242,7 @@ code.highlighted {
243242
display: block;
244243
min-width: 100%;
245244
width: 120%;
246-
height: 34px;
247-
padding: 6px 30px 6px 15px;
245+
padding: 6px 30px 6px 25px;
248246
color: #555555;
249247
border: none;
250248
background: transparent;
@@ -410,10 +408,6 @@ iframe.example {
410408
position:relative;
411409
}
412410

413-
.main-body-grid .side-navigation.ng-hide {
414-
display:block!important;
415-
}
416-
417411
.variables-matrix td {
418412
vertical-align:top;
419413
padding:5px;
@@ -514,7 +508,6 @@ h4 {
514508
.btn {
515509
color:#428bca;
516510
position: relative;
517-
width: auto;
518511
display: inline-block;
519512
margin: 0 0 2px;
520513
overflow: hidden;
@@ -586,7 +579,7 @@ ul.events > li {
586579

587580
@media only screen and (max-width : 768px) {
588581
.picker, .picker select {
589-
width:auto;
582+
width:100%;
590583
display:block;
591584
margin-bottom:10px;
592585
}
@@ -621,12 +614,6 @@ ul.events > li {
621614
.main-body-grid > .grid-right {
622615
margin-left:0;
623616
}
624-
.main-body-grid .side-navigation {
625-
display:block!important;
626-
}
627-
.main-body-grid .side-navigation.ng-hide {
628-
display:none!important;
629-
}
630617
.nav-index-group .nav-index-listing {
631618
display:inline-block;
632619
padding:3px 0;

docs/app/src/versions.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,23 @@ angular.module('versions', [])
44
$scope.docs_versions = NG_VERSIONS;
55
$scope.docs_version = NG_VERSIONS[0];
66

7+
for (var i = 0; i < NG_VERSIONS.length; i++) {
8+
if ( NG_VERSIONS[i].isStable ) {
9+
$scope.docs_stable_version = NG_VERSIONS[i];
10+
break;
11+
}
12+
}
13+
14+
$scope.getGroupName = function(v) {
15+
return v.isStable ? 'Stable' : 'Unstable';
16+
};
17+
18+
719
$scope.jumpToDocsVersion = function(version) {
820
var currentPagePath = $location.path();
921

1022
// TODO: We need to do some munging of the path for different versions of the API...
11-
23+
1224

1325
$window.location = version.docsUrl + currentPagePath;
1426
};

docs/config/templates/indexPage.template.html

+25-18
Original file line numberDiff line numberDiff line change
@@ -173,32 +173,39 @@ <h4 class="search-results-group-heading">{{ key }}</h4>
173173
</section>
174174
<section class="sup-header">
175175
<div class="container main-grid main-header-grid">
176-
<div class="grid-left">
177-
<div ng-controller="DocsVersionsCtrl" class="picker version-picker">
178-
<select ng-options="v as ('v' + v.version + (v.isSnapshot ? ' (snapshot)' : '')) group by (v.isStable?'Stable':'Unstable') for v in docs_versions"
179-
ng-model="docs_version"
180-
ng-change="jumpToDocsVersion(docs_version)"
181-
class="docs-version-jump">
182-
</select>
183-
</div>
184-
</div>
185-
<div class="grid-right">
186-
<ul class="nav-breadcrumb">
187-
<li ng-repeat="crumb in breadcrumb" class="nav-breadcrumb-entry naked-list">
188-
<span class="divider"> /</span>
189-
<a ng-href="{{crumb.url}}">{{crumb.name}}</a>
190-
</li>
191-
</ul>
192-
</div>
176+
<ul class="nav-breadcrumb">
177+
<li ng-repeat="crumb in breadcrumb" class="nav-breadcrumb-entry naked-list">
178+
<span class="divider"> /</span>
179+
<a ng-href="{{crumb.url}}">{{crumb.name}}</a>
180+
</li>
181+
</ul>
193182
</div>
194183
</section>
195184
</header>
196185

197186
<section role="main" class="container main-body">
198187
<div class="main-grid main-body-grid">
199188
<div class="grid-left">
189+
200190
<a class="btn toc-toggle visible-xs" ng-click="toc=!toc">Show / Hide Table of Contents</a>
201-
<div class="side-navigation" ng-show="toc==true">
191+
192+
<div ng-controller="DocsVersionsCtrl" class="version-panel" ng-class="{'hidden-xs':!toc}">
193+
<h3></h3>
194+
<div class="picker version-picker">
195+
<select ng-options="v as ('v' + v.version + (v.isSnapshot ? ' (snapshot)' : '')) group by getGroupName(v) for v in docs_versions"
196+
ng-model="docs_version"
197+
ng-change="jumpToDocsVersion(docs_version)"
198+
class="docs-version-jump">
199+
</select>
200+
</div>
201+
<button class="btn btn-block"
202+
ng-show="docs_version != docs_stable_version"
203+
ng-click="jumpToDocsVersion(docs_stable_version)">
204+
Stable: ({{docs_stable_version.version}})</button>
205+
</div>
206+
207+
<div class="side-navigation" ng-class="{'hidden-xs':!toc}">
208+
<h3></h3>
202209
<ul class="nav-list naked-list">
203210
<li ng-repeat="navGroup in currentArea.navGroups track by navGroup.name" class="nav-index-group">
204211
<a href="{{ navGroup.href }}" ng-class="navClass(navGroup)" class="nav-index-group-heading">{{ navGroup.name }}</a>

0 commit comments

Comments
 (0)