Skip to content

Commit e39fa05

Browse files
committed
Add GSoC report link for completed tasks
This commit adds the corresponding GSoC report link for completed tasks. Closes coala#703
1 parent c1a5d30 commit e39fa05

File tree

5 files changed

+54
-2
lines changed

5 files changed

+54
-2
lines changed

data/projects.liquid

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
{% for post in site.projects %}
55
{
66
"name" : "{{ post.name }}",
7+
"title" : "{{ post.improved_title }}",
78
"desc" : "{{ post.desc }}",
89
"requirements" : [{% for req in post.requirements %}"{{ req }}"{% unless forloop.last %},{% endunless %}
910
{% endfor %}],

data/reports.liquid

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
---
3+
[
4+
{% for report in site.reports %}
5+
{
6+
"categories": [{% for category in report.categories %}"{{ category }}"{% unless forloop.last %},{% endunless %}{% endfor %}],
7+
"date": "{{ report.date }}",
8+
"student": "{{ report.student }}",
9+
"project": "{{ report.project }}",
10+
"project_link": "{{ report.project_link }}",
11+
"url": "{{ report.url }}"
12+
}{% unless forloop.last %},{% endunless %}{% endfor %}
13+
]

partials/tabs/projects.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@ <h6><b>Filter Projects</b></h6>
8888
<li btf-markdown="req" class="milestones" ng-repeat="req in currentProject.requirements"></li>
8989
</ul>
9090
<br> </div>
91-
<div ng-show="currentProject.initiatives.length>0">
91+
<div ng-show="currentProject.initiatives.length>0 && currentProject.report === undefined">
9292
<div class="small-heading uppercase">Initiatives</div> <span class="chip" ng-repeat="initiative in currentProject.initiatives">{{ initiative }}</span>
9393
<br> </div>
94+
<div ng-show="currentProject.report.url.length>0">
95+
<div class="small-heading uppercase">{{ currentProject.report.initiative }}</div>
96+
<span class="chip gsoc-report" ng-click="redirectToReport()">Report</span>
97+
</div>
9498
<div ng-show="currentProject.collaborating_projects.length>0">
9599
<div class="small-heading uppercase">Collaborating projects</div> <span class="pr-element-detail chip" ng-repeat="project in currentProject.collaborating_projects">{{ project }}</span>
96100
<br> </div>

resources/css/style.css

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
.evenly-spread-content {
3535
justify-content: space-evenly;
3636
}
37+
.gsoc-report {
38+
cursor: pointer;
39+
}
3740
.hash_value_dup {
3841
position: 'absolute';
3942
left: '-9999px';

resources/js/directives/projects.js

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
angular.module('coala')
2-
.directive('projects', ['$http', '$timeout', '$location', 'Languages', 'orderByFilter', function ($http, $timeout, $location, Languages, orderBy) {
2+
.directive('projects', ['$http', '$timeout', '$location', '$window', 'Languages', 'orderByFilter', function ($http, $timeout, $location, $window, Languages, orderBy) {
33
return {
44
restrict: 'E',
55
templateUrl: '/partials/tabs/projects.html',
@@ -221,6 +221,7 @@ angular.module('coala')
221221
$scope.projectList = res.data;
222222
$scope.allProjects = res.data;
223223
$scope.projectRequest();
224+
$scope.mapReportToProject();
224225
})
225226
}
226227

@@ -397,6 +398,36 @@ angular.module('coala')
397398
}
398399

399400
$scope.getAllFilters();
401+
$scope.redirectToReport = function () {
402+
$window.open($scope.currentProject.report.url, '_blank');
403+
}
404+
405+
$scope.mapReportToProject = function () {
406+
$http.get('data/reports.liquid')
407+
.then(function (res) {
408+
var completedProjects = []
409+
angular.forEach($scope.projectList, function(project){
410+
if (project.status.includes('completed') && project.mentors.length > 0) {
411+
completedProjects.push(project)
412+
}
413+
})
414+
angular.forEach(res.data, function (report) {
415+
var completed_project = report.project.toLowerCase()
416+
angular.forEach(completedProjects, function (project) {
417+
var project_title = project.title.length > 0 ? project.title.toLowerCase() : project.name.toLowerCase()
418+
if (completed_project === project_title) {
419+
angular.forEach(project.initiatives, function (initiative) {
420+
if (report.categories.indexOf(initiative) != -1) {
421+
report.initiative = initiative
422+
project.report = report
423+
return
424+
}
425+
})
426+
}
427+
})
428+
})
429+
})
430+
}
400431
},
401432
controllerAs: 'lc'
402433
}

0 commit comments

Comments
 (0)