diff --git a/public/docs/_layout.jade b/public/docs/_layout.jade index 6e532a126b..5b1f09e395 100644 --- a/public/docs/_layout.jade +++ b/public/docs/_layout.jade @@ -9,14 +9,14 @@ html(lang="en" ng-app="angularIOApp" itemscope itemtype="http://schema.org/Frame != partial("../_includes/_hero") != partial("../_includes/_banner") - if current.path[3] == 'api' if current.path[4] == 'index' != yield else article(class="l-content-small grid-fluid docs-content") != yield - + else if current.path.indexOf('cheatsheet') > 0 + != yield else article(class="l-content-small grid-fluid docs-content") != yield diff --git a/public/docs/ts/latest/guide/AngularCheatSheet_Letter.pdf b/public/docs/ts/latest/guide/AngularCheatSheet_Letter.pdf new file mode 100644 index 0000000000..879ae76c80 Binary files /dev/null and b/public/docs/ts/latest/guide/AngularCheatSheet_Letter.pdf differ diff --git a/public/docs/ts/latest/guide/AngularCheatSheet_Poster.pdf b/public/docs/ts/latest/guide/AngularCheatSheet_Poster.pdf new file mode 100644 index 0000000000..32120dc534 Binary files /dev/null and b/public/docs/ts/latest/guide/AngularCheatSheet_Poster.pdf differ diff --git a/public/docs/ts/latest/guide/cheatsheet.jade b/public/docs/ts/latest/guide/cheatsheet.jade new file mode 100644 index 0000000000..8872671c22 --- /dev/null +++ b/public/docs/ts/latest/guide/cheatsheet.jade @@ -0,0 +1,27 @@ +.banner + p.text-body Angular 2 is currently in Developer Preview. We recommend using Angular 1.x for production applications. + +article(class="l-content-small grid-fluid docs-content") + .cheatsheet + h2 Angular for TypeScript Cheat Sheet (v2.0.0-alpha.43) + .downloads + a.download(href='AngularCheatSheet_Letter.pdf') + span.icon.icon-cloud-download + h4 Multi-page/A4 or Letter + h5 168KB (.pdf) + a.download(href='AngularCheatSheet_Poster.pdf') + span.icon.icon-cloud-download + h4 Poster/A2 or 18" x 24" + h5 369KB (.pdf) + br + br + + table(ng-repeat='section in cheatsheet') + tr + th {{section.syntax}} + th + code {{section.description}} + tr(ng-repeat='child in section.children') + td + code(bold='child.bold') {{child.syntax}} + td {{child.description}} diff --git a/public/resources/css/main.scss b/public/resources/css/main.scss index df89b52337..3c050928ed 100644 --- a/public/resources/css/main.scss +++ b/public/resources/css/main.scss @@ -42,6 +42,7 @@ @import 'module/statement'; @import 'module/example-title'; @import 'module/api'; +@import 'module/cheatsheet'; /* diff --git a/public/resources/css/module/cheatsheet.scss b/public/resources/css/module/cheatsheet.scss new file mode 100644 index 0000000000..74fe342fe0 --- /dev/null +++ b/public/resources/css/module/cheatsheet.scss @@ -0,0 +1,68 @@ +.cheatsheet { + font-family: "Roboto","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif; + .downloads { + overflow: hidden; + a { + float: left; + display: block; + margin: 0 ($unit * 4) 0 0; + text-decoration: none; + span { + float: left; + display: block; + font-size: 34px; + margin: 0 $unit 0 0; + line-height: 35px; + } + h4 { + margin: 0; + font-size: 16px; + white-space: nowrap; + overflow: hidden; + width: auto; + } + h5 { + font-size: 10px; + margin: ($unit * -1) 0 0; + color: black; + white-space: nowrap; + overflow: hidden; + width: auto; + } + } + } + table { + border-bottom: 5px solid #4D6A79; + width: 100%; + code { + background: transparent; + display: inline-block; + } + th { + background: #4D6A79; + color: white; + padding: $unit ($unit * 2); + box-sizing: border-box; + width: 50%; + code { + color: white; + } + &:last-child { + text-align: right; + } + &:first-child { + text-align: left; + } + } + td { + padding: $unit ($unit * 2); + box-sizing: border-box; + width: 50%; + vertical-align: top; + border: none; + } + tr:nth-child(odd) { + background: #E7EBEE; + } + } +} \ No newline at end of file diff --git a/public/resources/js/controllers/app-controller.js b/public/resources/js/controllers/app-controller.js index 86e9d52326..4169f6fd02 100644 --- a/public/resources/js/controllers/app-controller.js +++ b/public/resources/js/controllers/app-controller.js @@ -3,6 +3,27 @@ * */ +angularIO.directive('bold', function ($timeout) { + return { + scope: { bold: '=bold' }, + link: postLink + }; + function postLink (scope, element) { + var bold = typeof scope.bold === 'string' + ? [ scope.bold ] + : scope.bold; + $timeout(function () { + var html = element.html(); + angular.forEach(bold, function (bold) { + html = html.replace(new RegExp(bold.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"), 'g'), '$&'); + }); + html = html.replace(/\n/g, '
'); + html = html.replace(/ /g, ' '); + element.html(html); + }); + } +}); + angularIO.controller('AppCtrl', [ '$scope', '$mdDialog', '$timeout', function ($scope, $mdDialog, $timeout) { $scope.showDocsNav = false; $scope.showMainNav = false; @@ -1459,7 +1480,7 @@ angularIO.controller('AppCtrl', [ '$scope', '$mdDialog', '$timeout', function ($ "title": "ROUTER_DIRECTIVES", "originalModule": "angular2/router", "docType": "const" - },{ + }, { "title": "ROUTER_PRIMARY_COMPONENT", "originalModule": "angular2/router", "docType": "const" @@ -1686,6 +1707,339 @@ angularIO.controller('AppCtrl', [ '$scope', '$mdDialog', '$timeout', function ($ } ]; + $scope.cheatsheet = [ + { + "syntax": "Bootstrapping", + "description": "import {bootstrap} from 'angular2/angular2';", + "children": [ + { + "syntax": "", + "description": "Binds property value to the result of expression firstName.", + bold: '[value]' + }, + { + "syntax": "
", + "description": "Binds attribute role to the result of expression myAriaRole.", + bold: '[attr.role]' + }, + { + "syntax": "
", + "description": "Binds the presence of the css class extra-sparkle on the element to the truthiness of the expression isDelightful.", + bold: '[class.extra-sparkle]' + }, + { + "syntax": "
", + "description": "Binds style property width to the result of expression mySize in pixels. Units are optional.", + bold: '[style.width.px]' + }, + { + "syntax": "