Skip to content

Commit 46c15ff

Browse files
chore(docs): add button to link to stable docs
Closes angular#7513
1 parent f5555a1 commit 46c15ff

File tree

3 files changed

+35
-27
lines changed

3 files changed

+35
-27
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

+19-10
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,26 @@ <h4 class="search-results-group-heading">{{ key }}</h4>
186186
<section role="main" class="container main-body">
187187
<div class="main-grid main-body-grid">
188188
<div class="grid-left">
189-
<h2>Versions</h2>
190-
<div ng-controller="DocsVersionsCtrl" class="picker version-picker">
191-
<select ng-options="v as ('v' + v.version + (v.isSnapshot ? ' (snapshot)' : '')) group by (v.isStable?'Stable':'Unstable') for v in docs_versions"
192-
ng-model="docs_version"
193-
ng-change="jumpToDocsVersion(docs_version)"
194-
class="docs-version-jump">
195-
</select>
196-
</div>
189+
197190
<a class="btn toc-toggle visible-xs" ng-click="toc=!toc">Show / Hide Table of Contents</a>
198-
<div class="side-navigation" ng-show="toc==true">
199-
<h2>Contents</h2>
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>
200209
<ul class="nav-list naked-list">
201210
<li ng-repeat="navGroup in currentArea.navGroups track by navGroup.name" class="nav-index-group">
202211
<a href="{{ navGroup.href }}" ng-class="navClass(navGroup)" class="nav-index-group-heading">{{ navGroup.name }}</a>

0 commit comments

Comments
 (0)