forked from twitter/opensource-website
-
Notifications
You must be signed in to change notification settings - Fork 5
/
filters.js
1 lines (1 loc) · 1.12 KB
/
filters.js
1
angular.module("App.filters",[]).filter("githubTagsFilter",[function(){return function(issues,selectedLabels){if(void 0===selectedLabels)return issues;if(void 0===issues)return issues;var tempIssues=new Array;if(selectedLabels.length>0){for(var j=0;j<issues.length;j++){for(var issue_labels=new Array,i=0;i<issues[j].labels.length;i++)issue_labels.push(issues[j].labels[i].name);0===_.difference(selectedLabels,issue_labels).length&&tempIssues.push(issues[j])}return tempIssues}return issues}}]),angular.module("checkboxesFilter",[]).filter("checkboxesFilter",[function(){return function(issues,stateControls){if(void 0===stateControls)return issues;if(void 0===issues)return issues;if(stateControls.showIssuesWithComments===!1&&stateControls.showIssuesWithOutComments===!1)return new Array;var withComments=_.filter(issues,function(issue){return stateControls.showIssuesWithComments===!0?0!==issue.comments?!0:!1:0===issue.comments?!0:!1}),withoutComments=_.filter(issues,function(issue){return stateControls.showIssuesWithOutComments===!0?0===issue.comments?!0:!1:0!==issue.comments?!0:!1});return _.union(withComments,withoutComments)}}]);