diff --git a/public/_includes/_hero.jade b/public/_includes/_hero.jade index 53bf8fee5d..e02b60265a 100644 --- a/public/_includes/_hero.jade +++ b/public/_includes/_hero.jade @@ -20,6 +20,9 @@ header(class="hero background-sky") // badge circle is filled based on stability by matching a css selector in _hero.scss span(class="status-circle status-#{stability}") span Stability: #{capitalize(stability)} + if security + span(class="status-badge security-risk-badge"). + Security Risk if subtitle h2.hero-subtitle.text-subhead #{subtitle} diff --git a/public/resources/css/module/_hero.scss b/public/resources/css/module/_hero.scss index 568b84945d..4f1ca9c339 100644 --- a/public/resources/css/module/_hero.scss +++ b/public/resources/css/module/_hero.scss @@ -83,9 +83,18 @@ $hero-padding: ($unit * 10) ($unit * 6) ($unit * 7); margin-left: 0; } } + + .security-risk-badge { + background-color: #FFF59D; + } } @media screen and (max-width: 599px) { + /* three items */ + .badges .status-badge:nth-child(3) { + margin-left: 0; + margin-top: 4px; + } .hero-title-with-badges { margin-bottom: $unit * 2; diff --git a/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js b/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js index af64851333..d9edc7ccfd 100644 --- a/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js +++ b/tools/api-builder/angular.io-package/processors/addJadeDataDocsProcessor.js @@ -75,7 +75,7 @@ module.exports = function addJadeDataDocsProcessor() { } else if (_.has(exportDoc, 'deprecated')) { stability = 'deprecated'; } - + var howToUse = ''; if(_.has(exportDoc, 'howToUse')) { var howToUseArray = exportDoc.tags.tags.filter(function(tag) { @@ -96,6 +96,16 @@ module.exports = function addJadeDataDocsProcessor() { whatItDoes = whatItDoesArray[0].description.replace(/(\r\n|\n|\r)/gm,""); } + // SECURITY STATUS + // Supported tags: + // @security + // Default is no security risk assessed for api + var security = false; + if (_.has(exportDoc, 'security')) { + security = true; + } + + // Data inserted into jade-data.template.html var dataDoc = { name: exportDoc.name + '-' + exportDoc.docType, title: exportDoc.name, @@ -103,7 +113,8 @@ module.exports = function addJadeDataDocsProcessor() { exportDoc: exportDoc, stability: stability, howToUse: howToUse, - whatItDoes: whatItDoes + whatItDoes: whatItDoes, + security: security }; if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName); diff --git a/tools/api-builder/angular.io-package/tag-defs/index.js b/tools/api-builder/angular.io-package/tag-defs/index.js index e311d3cb43..782a09189e 100644 --- a/tools/api-builder/angular.io-package/tag-defs/index.js +++ b/tools/api-builder/angular.io-package/tag-defs/index.js @@ -6,4 +6,5 @@ module.exports = [ require('./stable'), require('./experimental'), require('./docsNotRequired'), + require('./security'), ]; diff --git a/tools/api-builder/angular.io-package/tag-defs/security.js b/tools/api-builder/angular.io-package/tag-defs/security.js new file mode 100644 index 0000000000..1fbd78d97a --- /dev/null +++ b/tools/api-builder/angular.io-package/tag-defs/security.js @@ -0,0 +1,5 @@ +module.exports = function() { + return { + name: 'security' + }; +}; diff --git a/tools/api-builder/angular.io-package/templates/jade-data.template.html b/tools/api-builder/angular.io-package/templates/jade-data.template.html index d92027ed12..22101aad40 100644 --- a/tools/api-builder/angular.io-package/templates/jade-data.template.html +++ b/tools/api-builder/angular.io-package/templates/jade-data.template.html @@ -15,6 +15,9 @@ {%- if item.stability %} "stability" : "{$ item.stability $}", {%- endif %} + {%- if item.security %} + "security" : "{$ item.security $}", + {%- endif %} "docType": "{$ item.docType $}" }{% if not loop.last %},{% endif %} {% endfor -%}