moved to requirejs
This commit is contained in:
1 parent
b651c6ac5e
commit
0565d23cc8
19 files changed
+468
-456
No files matched your search
@@ -0,0 +1,130 @@
|
||||
define(['m', '_', 'util', 'resultParser', 'views/topNavBar', 'views/footer'], function (m, _ , util, resultParser, topNavBar, footer) {
|
||||
var mainPageLogo = {};
|
||||
|
||||
mainPageLogo.view = function(){
|
||||
return m('div.uk-grid', [
|
||||
m('div.uk-width-1-3.uk-push-1-3', [
|
||||
m('div.uk-cover-background', {style: 'height: 500px; background-size: 500px; background-image: url(images/phenix_logo.png);'})
|
||||
])
|
||||
]);
|
||||
};
|
||||
|
||||
var mainPageNews = {};
|
||||
|
||||
mainPageNews.view = function(){
|
||||
return m('div.uk-panel.uk-panel-box',[
|
||||
m('div.uk-panel-badge.uk-badge', [
|
||||
m('i.fa.fa-newspaper-o')
|
||||
]),
|
||||
m('h3.uk-panel-title', 'Nouvelles')
|
||||
], util.loremIpsum());
|
||||
};
|
||||
|
||||
var nextGameDaySchedule = {};
|
||||
|
||||
nextGameDaySchedule.controller = function(){
|
||||
var games = m.prop([]);
|
||||
return m.request({method: "GET", url: "/api/resultats.json"})
|
||||
.then(games)
|
||||
.then(resultParser.getNightGames)
|
||||
.then(function(nightGames){
|
||||
return nightGames[0].games;
|
||||
});
|
||||
};
|
||||
|
||||
nextGameDaySchedule._getTableHead = function(){
|
||||
return m('thead', m('tr', [
|
||||
m('td', 'Date'),
|
||||
m('td', 'Heure'),
|
||||
m('td', 'Visiteur'),
|
||||
m('td', 'Receveur')
|
||||
]));
|
||||
};
|
||||
|
||||
nextGameDaySchedule._getGamesRow = function(game){
|
||||
return m('tr', [
|
||||
m('td', 'small txt'),
|
||||
m('td', game.time),
|
||||
m('td', game.away),
|
||||
m('td', game.home)
|
||||
]);
|
||||
};
|
||||
|
||||
nextGameDaySchedule._getGamesRows = function(games){
|
||||
return _.map(games(), nextGameDaySchedule._getGamesRow);
|
||||
};
|
||||
|
||||
nextGameDaySchedule.view = function(games){
|
||||
return m('table.uk-table.uk-table-hover.uk-table-striped.uk-table-condensed',
|
||||
m('tbody', [
|
||||
nextGameDaySchedule._getTableHead(),
|
||||
nextGameDaySchedule._getGamesRows(games)
|
||||
]));
|
||||
};
|
||||
|
||||
var mainPageSchedule = {};
|
||||
|
||||
mainPageSchedule.view = function(){
|
||||
return m('div.uk-panel.uk-panel-box',[
|
||||
m('div.uk-panel-badge.uk-badge', [
|
||||
m('i.fa.fa-clock-o')
|
||||
]),
|
||||
m('h3.uk-panel-title', 'Horaire'),
|
||||
m.component(nextGameDaySchedule)
|
||||
]);
|
||||
};
|
||||
|
||||
var mainMap = {};
|
||||
|
||||
mainMap.getMap = function(){
|
||||
var iframeUrl = "http://www.openstreetmap.org/export/embed.html?bbox=-73.55889558792114%2C45.53089890181621%2C-73.55181455612183%2C45.53426212742867&layer=mapnik";
|
||||
var externalLink = "http://www.openstreetmap.org/#map=18/45.53258/-73.55536";
|
||||
var iframeParams = {
|
||||
style: {border: '1px solid black', 'min-height': '300px'},
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
frameborder: 0,
|
||||
scrolling: 'no',
|
||||
marginheight: 0,
|
||||
src: iframeUrl
|
||||
};
|
||||
return [
|
||||
m('iframe', iframeParams),
|
||||
m('br'),
|
||||
m('small', m('a', {href: externalLink}, 'Voir la carte'))
|
||||
];
|
||||
};
|
||||
|
||||
mainMap.view = function(){
|
||||
return m('div.uk-panel.uk-panel-box',[
|
||||
m('div.uk-panel-badge.uk-badge', [
|
||||
m('i.fa.fa-map-o')
|
||||
]),
|
||||
m('h3.uk-panel-title', 'Parc Walter-Stewart'),
|
||||
mainMap.getMap()
|
||||
]);
|
||||
};
|
||||
|
||||
var mainPageBottom = {};
|
||||
|
||||
mainPageBottom.view = function(){
|
||||
return m('div.uk-grid',[
|
||||
m('div.uk-width-1-5'),
|
||||
m('div.uk-width-1-5', mainPageNews.view()),
|
||||
m('div.uk-width-1-5', mainPageSchedule.view()),
|
||||
m('div.uk-width-1-5', mainMap.view())
|
||||
]);
|
||||
};
|
||||
|
||||
var mainPage = {};
|
||||
|
||||
mainPage.view = function(){
|
||||
return [topNavBar.view(),
|
||||
mainPageLogo.view(),
|
||||
mainPageBottom.view(),
|
||||
footer.view()
|
||||
];
|
||||
};
|
||||
|
||||
return mainPage;
|
||||
});
|
||||
Reference in new issue
Block a user