Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mentors.html: Change mentor page year dynamically #709

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
---
---
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these being added?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jayvdb This is the frontmatter needed by jekyll to interpolate a file. Without this we cannot read the value gsocSwitchMonth from the _config.yml file as suggested by @li-boxuan.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid this @aedorado you can pass the value to function getGsocYear() from html page itself.
Doing so, will omit those two new lines containing hyphen

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please. embedding jekyll liquid variables inside JS is just too confusing ;-)

(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