Skip to content

Commit

Permalink
Add GSoC report link for completed tasks
Browse files Browse the repository at this point in the history
This commit adds the corresponding GSoC report
link for completed tasks.

Closes coala#703
  • Loading branch information
KVGarg committed Aug 26, 2019
1 parent c1a5d30 commit e39fa05
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 2 deletions.
1 change: 1 addition & 0 deletions data/projects.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{% for post in site.projects %}
{
"name" : "{{ post.name }}",
"title" : "{{ post.improved_title }}",
"desc" : "{{ post.desc }}",
"requirements" : [{% for req in post.requirements %}"{{ req }}"{% unless forloop.last %},{% endunless %}
{% endfor %}],
Expand Down
13 changes: 13 additions & 0 deletions data/reports.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
---
[
{% for report in site.reports %}
{
"categories": [{% for category in report.categories %}"{{ category }}"{% unless forloop.last %},{% endunless %}{% endfor %}],
"date": "{{ report.date }}",
"student": "{{ report.student }}",
"project": "{{ report.project }}",
"project_link": "{{ report.project_link }}",
"url": "{{ report.url }}"
}{% unless forloop.last %},{% endunless %}{% endfor %}
]
6 changes: 5 additions & 1 deletion partials/tabs/projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ <h6><b>Filter Projects</b></h6>
<li btf-markdown="req" class="milestones" ng-repeat="req in currentProject.requirements"></li>
</ul>
<br> </div>
<div ng-show="currentProject.initiatives.length>0">
<div ng-show="currentProject.initiatives.length>0 && currentProject.report === undefined">
<div class="small-heading uppercase">Initiatives</div> <span class="chip" ng-repeat="initiative in currentProject.initiatives">{{ initiative }}</span>
<br> </div>
<div ng-show="currentProject.report.url.length>0">
<div class="small-heading uppercase">{{ currentProject.report.initiative }}</div>
<span class="chip gsoc-report" ng-click="redirectToReport()">Report</span>
</div>
<div ng-show="currentProject.collaborating_projects.length>0">
<div class="small-heading uppercase">Collaborating projects</div> <span class="pr-element-detail chip" ng-repeat="project in currentProject.collaborating_projects">{{ project }}</span>
<br> </div>
Expand Down
3 changes: 3 additions & 0 deletions resources/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
.evenly-spread-content {
justify-content: space-evenly;
}
.gsoc-report {
cursor: pointer;
}
.hash_value_dup {
position: 'absolute';
left: '-9999px';
Expand Down
33 changes: 32 additions & 1 deletion resources/js/directives/projects.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
angular.module('coala')
.directive('projects', ['$http', '$timeout', '$location', 'Languages', 'orderByFilter', function ($http, $timeout, $location, Languages, orderBy) {
.directive('projects', ['$http', '$timeout', '$location', '$window', 'Languages', 'orderByFilter', function ($http, $timeout, $location, $window, Languages, orderBy) {
return {
restrict: 'E',
templateUrl: '/partials/tabs/projects.html',
Expand Down Expand Up @@ -221,6 +221,7 @@ angular.module('coala')
$scope.projectList = res.data;
$scope.allProjects = res.data;
$scope.projectRequest();
$scope.mapReportToProject();
})
}

Expand Down Expand Up @@ -397,6 +398,36 @@ angular.module('coala')
}

$scope.getAllFilters();
$scope.redirectToReport = function () {
$window.open($scope.currentProject.report.url, '_blank');
}

$scope.mapReportToProject = function () {
$http.get('data/reports.liquid')
.then(function (res) {
var completedProjects = []
angular.forEach($scope.projectList, function(project){
if (project.status.includes('completed') && project.mentors.length > 0) {
completedProjects.push(project)
}
})
angular.forEach(res.data, function (report) {
var completed_project = report.project.toLowerCase()
angular.forEach(completedProjects, function (project) {
var project_title = project.title.length > 0 ? project.title.toLowerCase() : project.name.toLowerCase()
if (completed_project === project_title) {
angular.forEach(project.initiatives, function (initiative) {
if (report.categories.indexOf(initiative) != -1) {
report.initiative = initiative
project.report = report
return
}
})
}
})
})
})
}
},
controllerAs: 'lc'
}
Expand Down

0 comments on commit e39fa05

Please sign in to comment.