docs(api/cheatsheet): show ng version + lang in page header (#2918)

This commit is contained in:
Patrice Chalin 2016-12-01 11:47:58 -08:00 committed by Filipe Silva
parent c7717b4850
commit 4a0c3d79b7
8 changed files with 22 additions and 19 deletions

View File

@ -13,8 +13,12 @@
if current.path[4] && current.path[3] == 'api'
- var textFormat = 'is-standard-case'
if current.path.indexOf('cheatsheet') > 0 || current.path[current.path.length-2] === 'api'
- var base = current.path[4] ? '../guide' : './guide';
- var ngVersion = '(v<ngio-cheatsheet src="' + base + '/cheatsheet.json" version-only>2.X.Y</ngio-cheatsheet>)';
header.hero.background-sky
h1(class="hero-title #{textFormat}") #{headerTitle}
h1(class="hero-title #{textFormat}") #{headerTitle} !{ngVersion}
if useBadges
if stability

View File

@ -49,9 +49,8 @@
},
"cheatsheet": {
"title": "Angular Cheat Sheet",
"title": "Cheat Sheet",
"subtitle": "Dart",
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
"reference": false
},

View File

@ -69,8 +69,8 @@
},
"cheatsheet": {
"title": "Angular Cheat Sheet",
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
"title": "Cheat Sheet",
"subtitle": "Dart",
"nextable": true,
"basics": true
},

View File

@ -41,9 +41,8 @@
},
"cheatsheet": {
"title": "Angular Cheat Sheet",
"title": "Cheat Sheet",
"subtitle": "JavaScript",
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
"reference": false
},

View File

@ -51,8 +51,8 @@
},
"cheatsheet": {
"title": "Angular Cheat Sheet",
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
"title": "Cheat Sheet",
"subtitle": "JavaScript",
"nextable": true,
"basics": true
},

View File

@ -49,9 +49,8 @@
},
"cheatsheet": {
"title": "Angular Cheat Sheet",
"title": "Cheat Sheet",
"subtitle": "TypeScript",
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
"reference": false
},

View File

@ -78,8 +78,8 @@
},
"cheatsheet": {
"title": "Angular Cheat Sheet",
"intro": "A quick guide to Angular syntax. (Content is provisional and may change.)",
"title": "Cheat Sheet",
"subtitle": "TypeScript",
"nextable": true,
"basics": true
},

View File

@ -1,21 +1,23 @@
angularIO.directive('ngioCheatsheet', function() {
return {
restrict: 'E',
scope: {},
controllerAs: '$ctrl',
controller: function($http, $attrs, $sce) {
var $ctrl = this;
$http.get($attrs.src).then(function(response) {
$ctrl.currentEnvironment = response.data.currentEnvironment;
$ctrl.version = response.data.version;
$ctrl.sections = response.data.sections;
if ($attrs.hasOwnProperty('versionOnly')) {
$ctrl.version = response.data.version.raw;
} else {
$ctrl.sections = response.data.sections;
}
});
$ctrl.getSafeHtml = function(html) {
return $sce.trustAsHtml(html);
};
},
template:
'<h2>Angular for {{$ctrl.currentEnvironment}} Cheat Sheet (v{{ $ctrl.version.raw }})</h2>' +
'<br>' +
'<div ng-if="!$ctrl.sections">Loading Cheatsheet...</div>\n' +
'<span ng-if="$ctrl.version">{{$ctrl.version}}</span>' +
'<table ng-repeat="section in $ctrl.sections" ng-cloak>\n' +
'<tr>\n' +
' <th>{{section.name}}</th>\n' +