From 05f805729e3fb2ea501d0b887c6103800c28dce9 Mon Sep 17 00:00:00 2001 From: KVGarg Date: Sun, 17 Feb 2019 21:57:36 +0530 Subject: [PATCH] Add GSoC report link for completed tasks This commit adds the corresponding GSoC report link for completed tasks. Closes #703 --- data/reports.liquid | 13 +++++++++++++ partials/tabs/projects.html | 4 ++++ resources/css/style.css | 3 +++ resources/js/app.js | 24 +++++++++++++++++++++++- 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 data/reports.liquid diff --git a/data/reports.liquid b/data/reports.liquid new file mode 100644 index 00000000..a575e015 --- /dev/null +++ b/data/reports.liquid @@ -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 %} +] diff --git a/partials/tabs/projects.html b/partials/tabs/projects.html index 58c125e4..caa1f0e6 100644 --- a/partials/tabs/projects.html +++ b/partials/tabs/projects.html @@ -60,6 +60,10 @@
Initiatives
{{ initiative }}
+
+
GSoC
+ Report +
Collaborating projects
{{ project }}
diff --git a/resources/css/style.css b/resources/css/style.css index f2395d87..0c90f3ca 100644 --- a/resources/css/style.css +++ b/resources/css/style.css @@ -1,3 +1,6 @@ +.gsoc-report { + cursor: pointer; +} .hash_value_dup { position: 'absolute'; left: '-9999px'; diff --git a/resources/js/app.js b/resources/js/app.js index af811167..02915781 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -87,7 +87,7 @@ } }) - app.directive('projects', ['$http', '$timeout', '$location', 'Languages', function ($http, $timeout, $location, Languages) { + app.directive('projects', ['$http', '$timeout', '$location', '$window', 'Languages', function ($http, $timeout, $location, $window, Languages) { return { restrict: 'E', templateUrl: '/partials/tabs/projects.html', @@ -110,6 +110,7 @@ .then(function (res) { $scope.projectList = res.data; $scope.projectRequest(); + $scope.mapReportToProject(); }) } @@ -281,6 +282,27 @@ $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() + ) { + project.report = report + } + }) + }) + }) + } + }, controllerAs: 'lc' }