diff --git a/data/projects.liquid b/data/projects.liquid index be375097..e02964bb 100644 --- a/data/projects.liquid +++ b/data/projects.liquid @@ -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 %}], 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..231397dc 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,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' }