feat(filter stable): filter by stability stable

This commit is contained in:
Eric Jimenez 2016-05-12 16:01:10 -04:00 committed by Eric Jimenez
parent 3db8642113
commit 42e8c4a10c
1 changed files with 11 additions and 0 deletions

View File

@ -27,6 +27,7 @@ angularIO.directive('apiList', function () {
var $ctrl = this;
$ctrl.apiTypes = [
{ cssClass: 'stable', title: 'Stable', matches: ['stable']},
{ cssClass: 'directive', title: 'Directive', matches: ['directive'] },
{ cssClass: 'decorator', title: 'Decorator', matches: ['decorator'] },
{ cssClass: 'class', title: 'Class', matches: ['class'] },
@ -51,6 +52,16 @@ angularIO.directive('apiList', function () {
var isVisible = false;
section.items.forEach(function(item) {
// Filter by stability (ericjim: only 'stable' for now)
if ($ctrl.apiType && $ctrl.apiType.matches.length === 1 &&
$ctrl.apiType.matches[0] === 'stable' && item.stability === 'stable') {
item.show = true;
isVisible = true;
return isVisible;
} // NOTE: other checks can be performed for stability (experimental, deprecated, etc)
// Filter by docType
var matchesDocType = !$ctrl.apiType || $ctrl.apiType.matches.indexOf(item.docType) !== -1;
var matchesTitle = !apiFilter || item.title.toLowerCase().indexOf(apiFilter) !== -1;
item.show = matchesDocType && (matchesTitle || matchesModule);