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 #703
  • Loading branch information
KVGarg committed Aug 26, 2019
1 parent 4c8db7f commit 0c0c445
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
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 @@ -54,9 +54,13 @@
<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
@@ -1,6 +1,9 @@
.break-word {
word-wrap: break-word;
}
.gsoc-report {
cursor: pointer;
}
.hash_value_dup {
position: 'absolute';
left: '-9999px';
Expand Down
32 changes: 31 additions & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
}
})

app.directive('projects', ['$http', '$timeout', '$location', 'Languages', 'orderByFilter', function ($http, $timeout, $location, Languages, orderBy) {
app.directive('projects', [
'$http', '$timeout', '$location', '$window', 'Languages', 'orderByFilter',
function ($http, $timeout, $location, $window, Languages, orderBy) {
return {
restrict: 'E',
templateUrl: '/partials/tabs/projects.html',
Expand All @@ -117,6 +119,7 @@
.then(function (res) {
$scope.projectList = res.data;
$scope.projectRequest();
$scope.mapReportToProject();
})
}

Expand Down Expand Up @@ -292,6 +295,33 @@
$scope.searchText = search_requested
}

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

$scope.mapReportToProject = function () {
$http.get('data/reports.liquid')
.then(function (res) {
angular.forEach(res.data, function (report) {
var completed_project = report.project.toLowerCase()
angular.forEach($scope.projectList, function (project) {
if (
project.status.indexOf('completed') !== -1 && project.mentors.length > 0 &&
completed_project === project.name.toLowerCase()
) {
angular.forEach(project.initiatives, function(initiative){
if(report.categories.indexOf(initiative) != -1){
report.initiative = initiative
return
}
})
project.report = report
}
})
})
})
}

},
controllerAs: 'lc'
}
Expand Down

0 comments on commit 0c0c445

Please sign in to comment.