Skip to content

Commit 12ccc7e

Browse files
committed
projects.html: Get related issues states from webservices
The commit adds a method, to get related issues states from coala Webservices and adds the issue state to a HashMap which is being used to get issue css class, when the project pop-ups. Closes #298
1 parent 353bed9 commit 12ccc7e

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

Diff for: partials/tabs/projects.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ <h6><b>Filter Google Summer of Code Projects</b></h6>
106106
<div ng-show="currentProject.developers_involved.length>0" class="project-detail-element">
107107
<div class="small-heading uppercase">Developers Involved</div> <span class="pr-element-detail chip" ng-repeat="developers in currentProject.developers_involved">@{{developers}}</span> </div>
108108
<div ng-show="currentProject.issues.length>0" class="project-detail-element">
109-
<div class="small-heading uppercase">Related issues</div> <span ng-click="redirect(issue)" class="pr-element-detail chip clickable" ng-repeat="issue in currentProject.issues">{{ issue | format_issue }}</span>
109+
<div class="small-heading uppercase">Related issues</div> <span ng-click="redirect(issue)" class="pr-element-detail chip clickable" ng-class="lc.getIssueStateClass(issue)" ng-repeat="issue in currentProject.issues">{{ issue | format_issue }}</span>
110110
<br>
111111
<br>
112112
<br>

Diff for: resources/css/style.css

+15
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
.center-content {
3232
justify-content: center;
3333
}
34+
.closed {
35+
background-color: #cb2431;
36+
color: white
37+
}
3438
.close-filters {
3539
right: 6%;
3640
margin-top: 1.25rem;
@@ -117,12 +121,23 @@ i.fa {
117121
.lighter-font {
118122
font-weight: lighter;
119123
}
124+
.merged {
125+
background-color: #6f42c1;
126+
color: white;
127+
}
120128
.no-events-available {
121129
font-size: 1.2em;
122130
height: 30vh;
123131
justify-content: center;
124132
flex-direction: column;
125133
}
134+
.no-state {
135+
background-color: #e4e4e4;
136+
}
137+
.open, .opened {
138+
background-color: #2cbe4e;
139+
color: white;
140+
}
126141
.project-detail-element > .clickable:hover, .clickable:hover .chip:hover {
127142
cursor: pointer;
128143
background-color: #f3f5f8;

Diff for: resources/js/app.js

+29
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
self.displayFilters = !self.displayFilters
122122
$('select').material_select();
123123
}
124+
self.issueStates = {}
124125

125126
$scope.sortOrder = function(project) {
126127
return mapping[project.status];
@@ -480,6 +481,34 @@
480481
}
481482

482483
$scope.getAllFilters();
484+
self.getIssueStateClass = function(issue){
485+
return self.issueStates[issue]
486+
}
487+
488+
function getIssueState(issue) {
489+
self.issueStates[issue] = 'no-state'
490+
$http({
491+
method: 'GET',
492+
url: 'https://webservices.coala.io/issue/details',
493+
params: { url: issue }
494+
}).then(function (response) {
495+
var issue_data = response.data
496+
self.issueStates[issue] = issue_data.state
497+
})
498+
}
499+
500+
function getAllRelatedIssuesState(){
501+
$http.get('data/projects.liquid')
502+
.then(function (res) {
503+
angular.forEach(res.data, function(project){
504+
angular.forEach(project.issues, function(issue){
505+
getIssueState(issue)
506+
})
507+
})
508+
})
509+
}
510+
getAllRelatedIssuesState()
511+
483512
},
484513
controllerAs: 'lc'
485514
}

0 commit comments

Comments
 (0)