From 45d2179032dd13db14dd18178743b0124a9bc787 Mon Sep 17 00:00:00 2001 From: Dylan Chun Wong Date: Fri, 30 May 2014 14:00:39 -0700 Subject: [PATCH] -Fixed bug that issues and label filters wouldn't show up on initial load. -Fixed Pull request label not appearing on pull requests. -Fixed logic on some filters --- js/aggregator.js | 4 ++-- js/main.js | 42 ++++++++++++++++++++++++------------------ templates/issues.html | 2 +- 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/js/aggregator.js b/js/aggregator.js index 299112f94..ce220f0d6 100644 --- a/js/aggregator.js +++ b/js/aggregator.js @@ -70,8 +70,8 @@ function GithubIssuesAggregator(){ 'issues': allIssues }; - callback(finalIssues); - return; + return callback(finalIssues); + } }) })(i) diff --git a/js/main.js b/js/main.js index dd14fb583..f8d8a7093 100755 --- a/js/main.js +++ b/js/main.js @@ -205,30 +205,33 @@ dashboardApp.controller('MarketplaceController', function ($scope, $http) { } }); + dashboardApp.controller('IssuesController', function ($scope, $http, filterFilter) { $scope.init = function () { $("#nav-issues").addClass('active'); var aggregator = new GithubIssuesAggregator(); + + $scope.issueFilters = {'hasPullRequest': '', 'hasAssignee': ''}; + + var labelArray = ['Community', 'blocked', + 'difficulty beginner', 'difficulty intermediate', 'difficulty advanced', + 'priority low', 'priority medium', 'priority high'] + $scope.labels = labelArray.map(function (label) { + return {'name': label, selected: false} + }); + + // selected labels + $scope.selection = []; + + // helper method + $scope.selectedLabels = function selectedLabels() { + return filterFilter($scope.labels, { selected: true }); + }; + aggregator.processIssues(function (data) { $scope.issues = data.issues; $scope.last_updated = data.last_updated; - $scope.issueFilters = {'hasPullRequest': ''}; - - var labelArray = ['Community', 'blocked', - 'difficulty beginner', 'difficulty intermediate', 'difficulty advanced', - 'priority low', 'priority medium', 'priority high'] - $scope.labels = labelArray.map(function (label) { - return {'name': label, selected: false} - }); - - // selected labels - $scope.selection = []; - - // helper method - $scope.selectedLabels = function selectedLabels() { - return filterFilter($scope.labels, { selected: true }); - }; // watch labels for changes $scope.$watch('labels|filter:{selected:true}', function (nv) { @@ -246,6 +249,7 @@ dashboardApp.controller('IssuesController', function ($scope, $http, filterFilte }); }); setTimeout(Hyphenator.run, 200); + $scope.$apply(); }); } @@ -279,8 +283,10 @@ dashboardApp.controller('IssuesController', function ($scope, $http, filterFilte issue.shouldShow = issue.shouldShow && showForLabels; } var showForAssignee = true; - if (issue.shouldShow && $scope.hasAssignee != 'undefined' && $scope.hasAssignee != null | $scope.hasAssignee == '' ) { - showForAssignee = (issue.assignee.name && $scope.hasAssignee == 'yes') | (!issue.assignee.name && $scope.hasAssignee == 'no'); + if (issue.shouldShow && $scope.hasAssignee != 'undefined' && $scope.hasAssignee != null | $scope.hasAssignee == '') { + showForAssignee = $scope.hasAssignee == '' + | (issue.assignee.name && $scope.hasAssignee == 'yes') + | (!issue.assignee.name && $scope.hasAssignee == 'no'); issue.shouldShow = issue.shouldShow && showForAssignee; } } diff --git a/templates/issues.html b/templates/issues.html index cb6eca7f5..0a7ac1b88 100644 --- a/templates/issues.html +++ b/templates/issues.html @@ -42,7 +42,7 @@ - + Pull Request