feat(security badge): add a security badge to api docs. Only appears if @security is present in angular2
This commit is contained in:
parent
96238bbfab
commit
b5d2973163
|
@ -20,6 +20,9 @@ header(class="hero background-sky")
|
||||||
// badge circle is filled based on stability by matching a css selector in _hero.scss
|
// badge circle is filled based on stability by matching a css selector in _hero.scss
|
||||||
span(class="status-circle status-#{stability}")
|
span(class="status-circle status-#{stability}")
|
||||||
span Stability: #{capitalize(stability)}
|
span Stability: #{capitalize(stability)}
|
||||||
|
if security
|
||||||
|
span(class="status-badge security-risk-badge").
|
||||||
|
Security Risk
|
||||||
|
|
||||||
if subtitle
|
if subtitle
|
||||||
h2.hero-subtitle.text-subhead #{subtitle}
|
h2.hero-subtitle.text-subhead #{subtitle}
|
||||||
|
|
|
@ -83,9 +83,18 @@ $hero-padding: ($unit * 10) ($unit * 6) ($unit * 7);
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.security-risk-badge {
|
||||||
|
background-color: #FFF59D;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 599px) {
|
@media screen and (max-width: 599px) {
|
||||||
|
/* three items */
|
||||||
|
.badges .status-badge:nth-child(3) {
|
||||||
|
margin-left: 0;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
.hero-title-with-badges {
|
.hero-title-with-badges {
|
||||||
margin-bottom: $unit * 2;
|
margin-bottom: $unit * 2;
|
||||||
|
|
|
@ -75,7 +75,7 @@ module.exports = function addJadeDataDocsProcessor() {
|
||||||
} else if (_.has(exportDoc, 'deprecated')) {
|
} else if (_.has(exportDoc, 'deprecated')) {
|
||||||
stability = 'deprecated';
|
stability = 'deprecated';
|
||||||
}
|
}
|
||||||
|
|
||||||
var howToUse = '';
|
var howToUse = '';
|
||||||
if(_.has(exportDoc, 'howToUse')) {
|
if(_.has(exportDoc, 'howToUse')) {
|
||||||
var howToUseArray = exportDoc.tags.tags.filter(function(tag) {
|
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,"");
|
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 = {
|
var dataDoc = {
|
||||||
name: exportDoc.name + '-' + exportDoc.docType,
|
name: exportDoc.name + '-' + exportDoc.docType,
|
||||||
title: exportDoc.name,
|
title: exportDoc.name,
|
||||||
|
@ -103,7 +113,8 @@ module.exports = function addJadeDataDocsProcessor() {
|
||||||
exportDoc: exportDoc,
|
exportDoc: exportDoc,
|
||||||
stability: stability,
|
stability: stability,
|
||||||
howToUse: howToUse,
|
howToUse: howToUse,
|
||||||
whatItDoes: whatItDoes
|
whatItDoes: whatItDoes,
|
||||||
|
security: security
|
||||||
};
|
};
|
||||||
|
|
||||||
if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
|
if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName);
|
||||||
|
|
|
@ -6,4 +6,5 @@ module.exports = [
|
||||||
require('./stable'),
|
require('./stable'),
|
||||||
require('./experimental'),
|
require('./experimental'),
|
||||||
require('./docsNotRequired'),
|
require('./docsNotRequired'),
|
||||||
|
require('./security'),
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
module.exports = function() {
|
||||||
|
return {
|
||||||
|
name: 'security'
|
||||||
|
};
|
||||||
|
};
|
|
@ -15,6 +15,9 @@
|
||||||
{%- if item.stability %}
|
{%- if item.stability %}
|
||||||
"stability" : "{$ item.stability $}",
|
"stability" : "{$ item.stability $}",
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
{%- if item.security %}
|
||||||
|
"security" : "{$ item.security $}",
|
||||||
|
{%- endif %}
|
||||||
"docType": "{$ item.docType $}"
|
"docType": "{$ item.docType $}"
|
||||||
}{% if not loop.last %},{% endif %}
|
}{% if not loop.last %},{% endif %}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
|
|
Loading…
Reference in New Issue