From 9bf75d3130cbfafd943020b038049412bafd4511 Mon Sep 17 00:00:00 2001 From: Anurag Sharma Date: Tue, 5 Feb 2019 06:54:16 +0000 Subject: [PATCH] mentors.html: Change mentor page year dynamically Have the year on the GSoC mentor page change dynamically based on the current month. If it's past September, the page will show the next year, otherwise it will show the current year. Closes https://github.com/coala/projects/issues/706 --- partials/tabs/mentors.html | 4 ++-- resources/js/app.js | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/partials/tabs/mentors.html b/partials/tabs/mentors.html index 28b87b02..233fc4a3 100644 --- a/partials/tabs/mentors.html +++ b/partials/tabs/mentors.html @@ -4,7 +4,7 @@

Hello there!

- We are the mentors for coala in GSoC 2018. + We are the mentors for coala in GSoC {{ getGsocYear() }}.

Just drop a message on Gitter - @@ -42,7 +42,7 @@

Admins

- We are the admins for coala in GSoC 2018. + We are the admins for coala in GSoC {{ getGsocYear() }}.

Just drop a message on Gitter diff --git a/resources/js/app.js b/resources/js/app.js index af811167..79677778 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,3 +1,5 @@ +--- +--- (function(){ var app = angular.module('coala', ['ngSanitize','btford.markdown', 'ngRoute']); @@ -386,6 +388,16 @@ self.mentorsList = {} self.adminsList = {} + $scope.getGsocYear = function() { + var gsocSwitchMonth = {{ site.gsoc_switch_month }} + var currentDate = new Date() + if (currentDate.getMonth() >= gsocSwitchMonth) { + return currentDate.getFullYear() + 1 + } else { + return currentDate.getFullYear() + } + } + $http.get('data/projects.liquid') .then(function (res) { $scope.projects = res.data.filter(project => project.status != "completed")