feat(security badge): add a security badge to api docs. Only appears if @security is present in angular2

This commit is contained in:
Eric Jimenez 2016-05-09 14:22:34 -04:00 committed by Naomi Black
parent 96238bbfab
commit b5d2973163
6 changed files with 34 additions and 2 deletions

View File

@ -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}

View File

@ -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;

View File

@ -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);

View File

@ -6,4 +6,5 @@ module.exports = [
require('./stable'),
require('./experimental'),
require('./docsNotRequired'),
require('./security'),
];

View File

@ -0,0 +1,5 @@
module.exports = function() {
return {
name: 'security'
};
};

View File

@ -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 -%}