From 42e8c4a10c3ed9ba265e9cd2717b2be5c9a05a9f Mon Sep 17 00:00:00 2001 From: Eric Jimenez Date: Thu, 12 May 2016 16:01:10 -0400 Subject: [PATCH] feat(filter stable): filter by stability stable --- public/resources/js/directives/api-list.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/resources/js/directives/api-list.js b/public/resources/js/directives/api-list.js index 98d41ef366..7be1c88d6d 100644 --- a/public/resources/js/directives/api-list.js +++ b/public/resources/js/directives/api-list.js @@ -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);