Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 4a0c3d7

Browse files
chalinfilipesilva
authored andcommitted
docs(api/cheatsheet): show ng version + lang in page header (#2918)
1 parent c7717b4 commit 4a0c3d7

File tree

8 files changed

+22
-19
lines changed

8 files changed

+22
-19
lines changed

public/_includes/_hero.jade

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
if current.path[4] && current.path[3] == 'api'
1414
- var textFormat = 'is-standard-case'
1515

16+
if current.path.indexOf('cheatsheet') > 0 || current.path[current.path.length-2] === 'api'
17+
- var base = current.path[4] ? '../guide' : './guide';
18+
- var ngVersion = '(v<ngio-cheatsheet src="' + base + '/cheatsheet.json" version-only>2.X.Y</ngio-cheatsheet>)';
19+
1620
header.hero.background-sky
17-
h1(class="hero-title #{textFormat}") #{headerTitle}
21+
h1(class="hero-title #{textFormat}") #{headerTitle} !{ngVersion}
1822

1923
if useBadges
2024
if stability

public/docs/dart/latest/_data.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@
4949
},
5050

5151
"cheatsheet": {
52-
"title": "Angular Cheat Sheet",
52+
"title": "Cheat Sheet",
5353
"subtitle": "Dart",
54-
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
5554
"reference": false
5655
},
5756

public/docs/dart/latest/guide/_data.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969
},
7070

7171
"cheatsheet": {
72-
"title": "Angular Cheat Sheet",
73-
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
72+
"title": "Cheat Sheet",
73+
"subtitle": "Dart",
7474
"nextable": true,
7575
"basics": true
7676
},

public/docs/js/latest/_data.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@
4141
},
4242

4343
"cheatsheet": {
44-
"title": "Angular Cheat Sheet",
44+
"title": "Cheat Sheet",
4545
"subtitle": "JavaScript",
46-
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
4746
"reference": false
4847
},
4948

public/docs/js/latest/guide/_data.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
},
5252

5353
"cheatsheet": {
54-
"title": "Angular Cheat Sheet",
55-
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
54+
"title": "Cheat Sheet",
55+
"subtitle": "JavaScript",
5656
"nextable": true,
5757
"basics": true
5858
},

public/docs/ts/latest/_data.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@
4949
},
5050

5151
"cheatsheet": {
52-
"title": "Angular Cheat Sheet",
52+
"title": "Cheat Sheet",
5353
"subtitle": "TypeScript",
54-
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
5554
"reference": false
5655
},
5756

public/docs/ts/latest/guide/_data.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@
7878
},
7979

8080
"cheatsheet": {
81-
"title": "Angular Cheat Sheet",
82-
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
81+
"title": "Cheat Sheet",
82+
"subtitle": "TypeScript",
8383
"nextable": true,
8484
"basics": true
8585
},

public/resources/js/directives/cheatsheet.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
angularIO.directive('ngioCheatsheet', function() {
22
return {
3+
restrict: 'E',
4+
scope: {},
35
controllerAs: '$ctrl',
46
controller: function($http, $attrs, $sce) {
57
var $ctrl = this;
68
$http.get($attrs.src).then(function(response) {
7-
$ctrl.currentEnvironment = response.data.currentEnvironment;
8-
$ctrl.version = response.data.version;
9-
$ctrl.sections = response.data.sections;
9+
if ($attrs.hasOwnProperty('versionOnly')) {
10+
$ctrl.version = response.data.version.raw;
11+
} else {
12+
$ctrl.sections = response.data.sections;
13+
}
1014
});
1115
$ctrl.getSafeHtml = function(html) {
1216
return $sce.trustAsHtml(html);
1317
};
1418
},
1519
template:
16-
'<h2>Angular for {{$ctrl.currentEnvironment}} Cheat Sheet (v{{ $ctrl.version.raw }})</h2>' +
17-
'<br>' +
18-
'<div ng-if="!$ctrl.sections">Loading Cheatsheet...</div>\n' +
20+
'<span ng-if="$ctrl.version">{{$ctrl.version}}</span>' +
1921
'<table ng-repeat="section in $ctrl.sections" ng-cloak>\n' +
2022
'<tr>\n' +
2123
' <th>{{section.name}}</th>\n' +

0 commit comments

Comments
 (0)