Added previous seasons to the web site
This commit is contained in:
1 parent
da7951b1cb
commit
cee0e920c3
7 files changed
+69
-302
No files matched your search
+2
-2
@@ -7,8 +7,8 @@
|
|||||||
time: "18:45"
|
time: "18:45"
|
||||||
away: jaune
|
away: jaune
|
||||||
home: gris
|
home: gris
|
||||||
home_points: 14
|
gris: 14
|
||||||
away_points: 16
|
jaune: 16
|
||||||
rain: false
|
rain: false
|
||||||
-
|
-
|
||||||
date: 2018/5/17 # year/month/day
|
date: 2018/5/17 # year/month/day
|
||||||
|
|||||||
@@ -1,281 +0,0 @@
|
|||||||
---
|
|
||||||
-
|
|
||||||
date: 2017/5/04 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: jaune
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/5/04 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: gris
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/5/11 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: rouge
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/5/11 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: bleu
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/5/18 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: gris
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/5/18 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: rouge
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/5/25 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: bleu
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/5/25 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: rouge
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/1 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: jaune
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/1 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: gris
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/8 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: bleu
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/8 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: jaune
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
rain: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/15 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: jaune
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/15 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: gris
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/22 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: rouge
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/22 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: bleu
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/29 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: gris
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/6/29 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: rouge
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/6 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: bleu
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/6 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: rouge
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/13 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: jaune
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/13 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: gris
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/20 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: bleu
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/20 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: jaune
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/27 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: jaune
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/7/27 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: gris
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/8/3 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: rouge
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/8/3 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: bleu
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/8/10 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: jaune
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/8/10 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: gris
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
-
|
|
||||||
date: 2017/8/17 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: gris
|
|
||||||
home: jaune
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/8/17 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: rouge
|
|
||||||
home: bleu
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/8/25 # year/month/day
|
|
||||||
time: "18:45"
|
|
||||||
away: bleu
|
|
||||||
home: rouge
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
temporary: false
|
|
||||||
|
|
||||||
-
|
|
||||||
date: 2017/8/25 # year/month/day
|
|
||||||
time: "20:20"
|
|
||||||
away: jaune
|
|
||||||
home: gris
|
|
||||||
home_points: ~
|
|
||||||
away_points: ~
|
|
||||||
temporary: false
|
|
||||||
+26
-2
@@ -12,6 +12,7 @@ var marked = require('marked');
|
|||||||
var spritz = require('spritzjs');
|
var spritz = require('spritzjs');
|
||||||
var modify = require('gulp-modify');
|
var modify = require('gulp-modify');
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
var fs = require('fs');
|
||||||
|
|
||||||
gulp.task('help', help);
|
gulp.task('help', help);
|
||||||
|
|
||||||
@@ -63,17 +64,40 @@ gulp.task('encrypt-results', ['compile-results'], function(){
|
|||||||
.pipe(gulp.dest('./api'));
|
.pipe(gulp.dest('./api'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getAvailableYears(files) {
|
||||||
|
var rgx = /^resultats(\d*).yaml/;
|
||||||
|
return files
|
||||||
|
.map((f) => rgx.exec(f))
|
||||||
|
.filter(_.isArray)
|
||||||
|
.map((a) => _.get(a, 1, ''))
|
||||||
|
.filter(_.identity)
|
||||||
|
.sort();
|
||||||
|
}
|
||||||
|
|
||||||
gulp.task('template-prod', function () {
|
gulp.task('template-prod', function () {
|
||||||
|
var dataFiles = fs.readdirSync('./data');
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
production: true,
|
||||||
|
availableYears: JSON.stringify(getAvailableYears(dataFiles)),
|
||||||
|
salt: process.env.SALT,
|
||||||
|
playerListLocation: process.env.PLAYER_LIST_LOCATION}
|
||||||
return gulp.src('index.tmpl.html')
|
return gulp.src('index.tmpl.html')
|
||||||
.pipe(rename("index.html"))
|
.pipe(rename("index.html"))
|
||||||
.pipe(template({production: true, salt: process.env.SALT, playerListLocation: process.env.PLAYER_LIST_LOCATION}))
|
.pipe(template(data))
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('template-dev', function () {
|
gulp.task('template-dev', function () {
|
||||||
|
var dataFiles = fs.readdirSync('./data');
|
||||||
|
var data = {
|
||||||
|
availableYears: JSON.stringify(getAvailableYears(dataFiles)),
|
||||||
|
production: false,
|
||||||
|
salt: 'salt',
|
||||||
|
playerListLocation: 'api/players.spritz.js'}
|
||||||
return gulp.src('index.tmpl.html')
|
return gulp.src('index.tmpl.html')
|
||||||
.pipe(rename("index.html"))
|
.pipe(rename("index.html"))
|
||||||
.pipe(template({production: false, salt: 'salt', playerListLocation: 'api/players.spritz.js'}))
|
.pipe(template(data))
|
||||||
.pipe(gulp.dest('.'));
|
.pipe(gulp.dest('.'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<body>
|
<body>
|
||||||
<script>
|
<script>
|
||||||
window.salt = "<%= salt %>";
|
window.salt = "<%= salt %>";
|
||||||
|
window.availableYears = <%= availableYears %>;
|
||||||
</script>
|
</script>
|
||||||
<script src="<%= playerListLocation %>"></script>
|
<script src="<%= playerListLocation %>"></script>
|
||||||
<%if(production){ %>
|
<%if(production){ %>
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ requirejs(['m', 'views/mainPage', 'views/historicPage', 'views/newsPage', 'views
|
|||||||
"/nouvelles": newsPage,
|
"/nouvelles": newsPage,
|
||||||
"/inscription-form": inscriptionForm,
|
"/inscription-form": inscriptionForm,
|
||||||
"/calendrier": calendarPage,
|
"/calendrier": calendarPage,
|
||||||
"/calendrier/playoff": calendarPage,
|
"/calendrier/:year": calendarPage,
|
||||||
"/reglement": rulesPage,
|
"/reglement": rulesPage,
|
||||||
"/photos": photosPage,
|
"/photos": photosPage,
|
||||||
"/membre": confidentialPage,
|
"/membre": confidentialPage,
|
||||||
|
|||||||
@@ -14,7 +14,18 @@ define(['_'], function(_) {
|
|||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
resultParser._setCanonicalPoints = function(res){
|
||||||
|
if(!_.isNumber(res.home_points) && _.isNumber(_.get(res, res.home))){
|
||||||
|
res.home_points = res[res.home];
|
||||||
|
}
|
||||||
|
if(!_.isNumber(res.away_points) && _.isNumber(_.get(res, res.away))){
|
||||||
|
res.away_points = res[res.away];
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
resultParser.parseResults = function(rawResults){
|
resultParser.parseResults = function(rawResults){
|
||||||
|
rawResults = _.map(rawResults, resultParser._setCanonicalPoints);
|
||||||
rawResults = _.map(rawResults, resultParser._addJSDateToResult);
|
rawResults = _.map(rawResults, resultParser._addJSDateToResult);
|
||||||
rawResults = _.map(rawResults, resultParser._addCustomStyle);
|
rawResults = _.map(rawResults, resultParser._addCustomStyle);
|
||||||
return rawResults;
|
return rawResults;
|
||||||
@@ -108,6 +119,7 @@ define(['_'], function(_) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
resultParser.getStats = function(rawResults){
|
resultParser.getStats = function(rawResults){
|
||||||
|
rawResults = _.map(rawResults, resultParser._setCanonicalPoints);
|
||||||
var allTeams = resultParser._getAllTeams(resultParser._removeTemporaryResults(rawResults));
|
var allTeams = resultParser._getAllTeams(resultParser._removeTemporaryResults(rawResults));
|
||||||
var getTeamStats = _.partial(resultParser._getTeamStats, rawResults);
|
var getTeamStats = _.partial(resultParser._getTeamStats, rawResults);
|
||||||
return _.map(allTeams, getTeamStats);
|
return _.map(allTeams, getTeamStats);
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/footer', 'images/rain.svg'], function(m, _, util, resultParser, teams, topNavBar, footer, rainSvg) {
|
define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/footer', 'images/rain.svg'], function(m, _, util, resultParser, teams, topNavBar, footer, rainSvg) {
|
||||||
|
function ppYear(year, availableYears) {
|
||||||
|
return _.last(availableYears) == year ? "" : year;
|
||||||
|
}
|
||||||
|
|
||||||
var statsView = {};
|
var statsView = {};
|
||||||
|
|
||||||
statsView.controller = function(){
|
statsView.controller = function(year){
|
||||||
var games = m.prop([]);
|
var games = m.prop([]);
|
||||||
return m.request({method: "GET", url: "api/resultats.json"})
|
var url = "api/resultats" + year + ".json";
|
||||||
|
return m.request({method: "GET", url: url})
|
||||||
.then(games)
|
.then(games)
|
||||||
.then(resultParser.getStats);
|
.then(resultParser.getStats);
|
||||||
};
|
};
|
||||||
@@ -63,10 +68,10 @@ define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/foo
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
statsView.view = function(stats){
|
statsView.view = function(stats, year){
|
||||||
return m('div.uk-grid',
|
return m('div.uk-grid',
|
||||||
m('div.uk-width-medium-1-1.uk-width-large-1-1.uk-container-center',[
|
m('div.uk-width-medium-1-1.uk-width-large-1-1.uk-container-center',[
|
||||||
m('h2', 'Classement 2018'),
|
m('h2', 'Classement ' + year),
|
||||||
statsView.mainTable(stats()),
|
statsView.mainTable(stats()),
|
||||||
statsView.legend()
|
statsView.legend()
|
||||||
]));
|
]));
|
||||||
@@ -75,12 +80,16 @@ define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/foo
|
|||||||
|
|
||||||
var tabView = {};
|
var tabView = {};
|
||||||
|
|
||||||
tabView.view = function(vnode, isPlayoff){
|
tabView._createTab = function(activeYear, availableYears, year){
|
||||||
return m('div.uk-margin', m('h2', 'Calendrier 2018'),
|
var isActive = (activeYear == year) || (activeYear == ppYear(year, availableYears));
|
||||||
m('ul.uk-tab', [
|
return m('li', {'class': isActive ? 'uk-active': ''}, // 'uk-active'
|
||||||
m('li', {'class': isPlayoff || 'uk-active'},
|
m('a', {href: '#/calendrier/' + ppYear(year, availableYears)}, 'Saison ' + year));
|
||||||
m('a', {href: '#/calendrier'}, 'Saison')),
|
}
|
||||||
]));
|
|
||||||
|
tabView.view = function(vnode, isPlayoff, activeYear, availableYears){
|
||||||
|
var createTab = _.partial(tabView._createTab, activeYear, availableYears);
|
||||||
|
return m('div.uk-margin', m('h2', 'Calendrier ' + ppYear(activeYear, availableYears)),
|
||||||
|
m('ul.uk-tab', _.reverse(_.map(availableYears, createTab))));
|
||||||
};
|
};
|
||||||
|
|
||||||
var playoffView = {};
|
var playoffView = {};
|
||||||
@@ -110,9 +119,10 @@ define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/foo
|
|||||||
|
|
||||||
var schedulView = {};
|
var schedulView = {};
|
||||||
|
|
||||||
schedulView.controller = function(){
|
schedulView.controller = function(year){
|
||||||
var games = m.prop([]);
|
var games = m.prop([]);
|
||||||
return m.request({method: "GET", url: "api/resultats.json"})
|
var url = "api/resultats" + year + ".json"
|
||||||
|
return m.request({method: "GET", url: url})
|
||||||
.then(games)
|
.then(games)
|
||||||
.then(resultParser.getNightGames);
|
.then(resultParser.getNightGames);
|
||||||
};
|
};
|
||||||
@@ -168,14 +178,15 @@ define(['m', '_', 'util', 'resultParser', 'teams', 'views/topNavBar', 'views/foo
|
|||||||
calendarPage = {};
|
calendarPage = {};
|
||||||
|
|
||||||
calendarPage.view = function(vnode){
|
calendarPage.view = function(vnode){
|
||||||
var toto = vnode;
|
|
||||||
var isPlayoff = window.location.hash.endsWith('playoff');
|
var isPlayoff = window.location.hash.endsWith('playoff');
|
||||||
var main = isPlayoff ? m.component(playoffView) : m.component(schedulView);
|
var year = _.get(m.route.param(), 'year', '');
|
||||||
|
var availableYears = window.availableYears || [];
|
||||||
|
var main = isPlayoff ? m.component(playoffView) : m.component(schedulView, year, availableYears);
|
||||||
return [m.component(topNavBar),
|
return [m.component(topNavBar),
|
||||||
m('div.uk-grid.uk-margin-top.uk-margin-bottom',
|
m('div.uk-grid.uk-margin-top.uk-margin-bottom',
|
||||||
m('div.uk-width-large-3-5.uk-width-medium-4-5.uk-width-small-1-1.uk-container-center',[
|
m('div.uk-width-large-3-5.uk-width-medium-4-5.uk-width-small-1-1.uk-container-center',[
|
||||||
m.component(statsView),
|
m.component(statsView, year, availableYears),
|
||||||
m.component(tabView, isPlayoff),
|
m.component(tabView, isPlayoff, year, availableYears),
|
||||||
main
|
main
|
||||||
])),
|
])),
|
||||||
m.component(footer)];
|
m.component(footer)];
|
||||||
|
|||||||
Reference in new issue
Block a user