Skip to content

Commit

Permalink
mentors.html: Change mentor page year dynamically
Browse files Browse the repository at this point in the history
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 coala#706
  • Loading branch information
aedorado committed Feb 7, 2019
1 parent fa09436 commit 9bf75d3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions partials/tabs/mentors.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="col m8 offset-m2">
<h1 class="fine center">Hello there!</h1>
<h4 class="light center">
We are the mentors for coala in GSoC 2018.
We are the mentors for coala in GSoC {{ getGsocYear() }}.
</h4>
<h4 class="light center">
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a> -
Expand Down Expand Up @@ -42,7 +42,7 @@ <h4 class="light center">
<div class="col m8 offset-m2">
<h1 class="fine center">Admins</h1>
<h4 class="light center">
We are the admins for coala in GSoC 2018.
We are the admins for coala in GSoC {{ getGsocYear() }}.
</h4>
<h4 class="light center">
Just drop a message on <a href="https://coala.io/chat" class="bear-link">Gitter</a>
Expand Down
12 changes: 12 additions & 0 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
---
(function(){
var app = angular.module('coala', ['ngSanitize','btford.markdown', 'ngRoute']);

Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 9bf75d3

Please sign in to comment.