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 6e97a34e..00cf71bf 100644 --- a/partials/tabs/projects.html +++ b/partials/tabs/projects.html @@ -54,9 +54,13 @@

  • -
    +
    Initiatives
    {{ initiative }}
    +
    +
    {{ currentProject.report.initiative }}
    + Report +
    Collaborating projects
    {{ project }}
    diff --git a/resources/css/style.css b/resources/css/style.css index e86eac89..724b0a14 100644 --- a/resources/css/style.css +++ b/resources/css/style.css @@ -1,6 +1,9 @@ .break-word { word-wrap: break-word; } +.gsoc-report { + cursor: pointer; +} .hash_value_dup { position: 'absolute'; left: '-9999px'; diff --git a/resources/js/app.js b/resources/js/app.js index ce68b0d4..71029cb6 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -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', @@ -117,6 +119,7 @@ .then(function (res) { $scope.projectList = res.data; $scope.projectRequest(); + $scope.mapReportToProject(); }) } @@ -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' }