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

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion public/_includes/_hero.jade
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions public/docs/dart/latest/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},

Expand Down
4 changes: 2 additions & 2 deletions public/docs/dart/latest/guide/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
3 changes: 1 addition & 2 deletions public/docs/js/latest/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},

Expand Down
4 changes: 2 additions & 2 deletions public/docs/js/latest/guide/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
3 changes: 1 addition & 2 deletions public/docs/ts/latest/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},

Expand Down
4 changes: 2 additions & 2 deletions public/docs/ts/latest/guide/_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
14 changes: 8 additions & 6 deletions public/resources/js/directives/cheatsheet.js
Original file line number Diff line number Diff line change
@@ -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' +
Expand Down