Skip to content

Commit

Permalink
app.js: Get mentors from Webservices
Browse files Browse the repository at this point in the history
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
  • Loading branch information
KVGarg committed Aug 9, 2019
1 parent f19f787 commit 5ad30fb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 10 deletions.
8 changes: 4 additions & 4 deletions partials/tabs/mentors.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col m8 offset-m2">
<h1 class="fine center">Hello there!</h1>
<h4 class="light center">
We are the mentors for coala in GSoC 2018.
We are the mentors for coala in GSoC {{ gic.nextProgramYear }}.
</h4>
<h4 class="light center">
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a> -
Expand All @@ -18,7 +18,7 @@ <h4 class="light center">
<div class="row user">
<div class="parent-wrapper">
<div class="parent">
<div ng-repeat="member in gic.mentorsList" class="card child card-main sc">
<div ng-repeat="member in gic.mentorsList" class="card child card-main sc black-shadow">
<a ng-href="https://github.com/{{member.github_handle}}">
<div class="empty"></div>
<!-- data-proofer-ignore as html-proofer doesn't recognise ng-src -->
Expand All @@ -42,7 +42,7 @@ <h4 class="light center">
<div class="col m8 offset-m2">
<h1 class="fine center">Admins</h1>
<h4 class="light center">
We are the admins for coala in GSoC 2018.
We are the admins for coala in GSoC {{ gic.nextProgramYear }}.
</h4>
<h4 class="light center">
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a>
Expand All @@ -55,7 +55,7 @@ <h4 class="light center">
<div class="row user">
<div class="parent-wrapper">
<div class="parent">
<div ng-repeat="member in gic.adminsList" class="card card-main child sc">
<div ng-repeat="member in gic.adminsList" class="card card-main child sc black-shadow">
<a ng-href="https://github.com/{{member.github_handle}}">
<div class="empty"></div>
<!-- data-proofer-ignore as html-proofer doesn't recognise ng-src -->
Expand Down
3 changes: 3 additions & 0 deletions resources/css/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.black-shadow {
box-shadow: 0 0 15px 2px black;
}
.hash_value_dup {
position: 'absolute';
left: '-9999px';
Expand Down
36 changes: 30 additions & 6 deletions resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,20 +386,44 @@
self.mentorsList = {}
self.adminsList = {}

$scope.getMentorsWebservicesURL = function(year){
return 'https://webservices.coala.io/mentors?year='+year+'&program=GSoC'
}

var today = new Date()
if (today.getMonth() >= 6){
self.nextProgramYear = today.getFullYear() + 1
}
else {
self.nextProgramYear = today.getFullYear()
}

var mentorsWebservicesURL = $scope.getMentorsWebservicesURL(self.nextProgramYear);

$http.get(mentorsWebservicesURL)
.then(function(response){
var mentors = response.data
angular.forEach(mentors, function (data) {
self.mentorsList[data.user.login] = {
"github_handle": data.user.login,
"github_avatar_url": "https://avatars.githubusercontent.com/" + data.user.login
}
});
})
$http.get('data/projects.liquid')
.then(function (res) {
$scope.projects = res.data.filter(project => project.status != "completed")
angular.forEach($scope.projects, function(value, key){
angular.forEach(value.mentors, function(value, key){
self.mentorsList[value] = {
"github_handle" : value,
"github_avatar_url": "https://avatars.githubusercontent.com/" +value
angular.forEach($scope.projects, function (value, key) {
angular.forEach(value.mentors, function (value, key) {
self.mentorsList[value] = {
"github_handle": value,
"github_avatar_url": "https://avatars.githubusercontent.com/" + value
}
});
});
})

$http.get('data/admins.json')
$http.get('data/admins.json')
.then(function (res) {
admins = res.data
angular.forEach(admins, function(value, key){
Expand Down

0 comments on commit 5ad30fb

Please sign in to comment.