Skip to content

Commit 4e9e4b2

Browse files
committed
app.js: Get mentors from Webservices
The webservices now has a table for mentors, that stores the requests created by contributor on the community website. After all checks are green, the contributor is added a mentor for the upcoming program based on the request. Therefore, fetch all those contributors from webservices for the upcoming GSoC program and append them to the mentors list Closes #728
1 parent f19f787 commit 4e9e4b2

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

partials/tabs/mentors.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="col m8 offset-m2">
55
<h1 class="fine center">Hello there!</h1>
66
<h4 class="light center">
7-
We are the mentors for coala in GSoC 2018.
7+
We are the mentors for coala in GSoC {{ gic.nextProgramYear }}.
88
</h4>
99
<h4 class="light center">
1010
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a> -
@@ -18,7 +18,7 @@ <h4 class="light center">
1818
<div class="row user">
1919
<div class="parent-wrapper">
2020
<div class="parent">
21-
<div ng-repeat="member in gic.mentorsList" class="card child card-main sc">
21+
<div ng-repeat="member in gic.mentorsList" class="card child card-main sc black-shadow">
2222
<a ng-href="https://github.com/{{member.github_handle}}">
2323
<div class="empty"></div>
2424
<!-- data-proofer-ignore as html-proofer doesn't recognise ng-src -->
@@ -42,7 +42,7 @@ <h4 class="light center">
4242
<div class="col m8 offset-m2">
4343
<h1 class="fine center">Admins</h1>
4444
<h4 class="light center">
45-
We are the admins for coala in GSoC 2018.
45+
We are the admins for coala in GSoC {{ gic.nextProgramYear }}.
4646
</h4>
4747
<h4 class="light center">
4848
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a>
@@ -55,7 +55,7 @@ <h4 class="light center">
5555
<div class="row user">
5656
<div class="parent-wrapper">
5757
<div class="parent">
58-
<div ng-repeat="member in gic.adminsList" class="card card-main child sc">
58+
<div ng-repeat="member in gic.adminsList" class="card card-main child sc black-shadow">
5959
<a ng-href="https://github.com/{{member.github_handle}}">
6060
<div class="empty"></div>
6161
<!-- data-proofer-ignore as html-proofer doesn't recognise ng-src -->

resources/css/style.css

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.black-shadow {
2+
box-shadow: 0 0 15px 2px black;
3+
}
14
.hash_value_dup {
25
position: 'absolute';
36
left: '-9999px';

resources/js/app.js

+24
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,30 @@
386386
self.mentorsList = {}
387387
self.adminsList = {}
388388

389+
$scope.getMentorsWebservicesURL = function(year){
390+
return 'https://webservices.coala.io/mentors?year='+year+'&program=GSoC'
391+
}
392+
393+
var today = new Date()
394+
if (today.getMonth() >= 6){
395+
self.nextProgramYear = today.getFullYear() + 1
396+
}
397+
else {
398+
self.nextProgramYear = today.getFullYear()
399+
}
400+
401+
var mentorsWebservicesURL = $scope.getMentorsWebservicesURL(self.nextProgramYear);
402+
403+
$http.get(mentorsWebservicesURL)
404+
.then(function(response){
405+
var mentors = response.data
406+
angular.forEach(mentors, function (data) {
407+
self.mentorsList[data.user.login] = {
408+
"github_handle": data.user.login,
409+
"github_avatar_url": "https://avatars.githubusercontent.com/" + data.user.login
410+
}
411+
});
412+
})
389413
$http.get('data/projects.liquid')
390414
.then(function (res) {
391415
$scope.projects = res.data.filter(project => project.status != "completed")

0 commit comments

Comments
 (0)