From 53e114feffec61fe848cec554a2cadc64c8fe4ba 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 | 6 +++++- resources/css/style.css | 3 +++ resources/js/directives/projects.js | 26 +++++++++++++++++++++++++- 4 files changed, 46 insertions(+), 2 deletions(-) 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 e0b015e9..5636d6fb 100644 --- a/partials/tabs/projects.html +++ b/partials/tabs/projects.html @@ -88,9 +88,13 @@
Filter Projects

  • -
    +
    Initiatives
    {{ initiative }}
    +
    +
    {{ currentProject.report.initiative }}
    + Report +
    Collaborating projects
    {{ project }}
    diff --git a/resources/css/style.css b/resources/css/style.css index 099a157b..0d624a4b 100644 --- a/resources/css/style.css +++ b/resources/css/style.css @@ -34,6 +34,9 @@ .evenly-spread-content { justify-content: space-evenly; } +.gsoc-report { + cursor: pointer; +} .hash_value_dup { position: 'absolute'; left: '-9999px'; diff --git a/resources/js/directives/projects.js b/resources/js/directives/projects.js index 3617f189..60709e1e 100644 --- a/resources/js/directives/projects.js +++ b/resources/js/directives/projects.js @@ -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', @@ -221,6 +221,7 @@ angular.module('coala') $scope.projectList = res.data; $scope.allProjects = res.data; $scope.projectRequest(); + $scope.mapReportToProject(); }) } @@ -397,6 +398,29 @@ 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) { + 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 + project.report = report + return + } + }) + } + }) + }) + }) + } }, controllerAs: 'lc' }