refactored login page out
This commit is contained in:
1 parent
73f4f3b8e0
commit
bfd839b4cb
3 files changed
+41
-81
No files matched your search
@@ -1,4 +1,4 @@
|
||||
define(['m', '_', 'teams', 'views/topNavBar', 'views/footer'], function (m, _ , teams, topNavBar, footer) {
|
||||
define(['m', '_', 'teams', 'views/loginPage', 'views/topNavBar', 'views/footer'], function (m, _ , teams, loginPage, topNavBar, footer) {
|
||||
|
||||
|
||||
var confidentialSelection = {};
|
||||
@@ -175,9 +175,9 @@ define(['m', '_', 'teams', 'views/topNavBar', 'views/footer'], function (m, _ ,
|
||||
]);
|
||||
};
|
||||
|
||||
confidentialTable.onlyPlayerOfTeam = function(visibleTeam){
|
||||
confidentialTable.onlyPlayerOfTeams = function(visibleTeams){
|
||||
return function(player){
|
||||
return _.includes(visibleTeam, player.team);
|
||||
return _.includes(visibleTeams, player.team);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -187,10 +187,10 @@ define(['m', '_', 'teams', 'views/topNavBar', 'views/footer'], function (m, _ ,
|
||||
};
|
||||
};
|
||||
|
||||
confidentialTable.tableBody = function(players, visibleTeam, activatedScores){
|
||||
confidentialTable.tableBody = function(players, visibleTeams, activatedScores){
|
||||
return m('tbody',
|
||||
_(players)
|
||||
.filter(confidentialTable.onlyPlayerOfTeam(visibleTeam))
|
||||
.filter(confidentialTable.onlyPlayerOfTeams(visibleTeams))
|
||||
.filter(confidentialTable.onlyPlayerOfScore(activatedScores))
|
||||
.map(confidentialTable.playerRow).value()
|
||||
);
|
||||
@@ -226,64 +226,12 @@ define(['m', '_', 'teams', 'views/topNavBar', 'views/footer'], function (m, _ ,
|
||||
};
|
||||
|
||||
|
||||
var loginComponent = {};
|
||||
|
||||
loginComponent.controller = function(){
|
||||
return {email: m.prop(''), password: m.prop('')};
|
||||
};
|
||||
|
||||
loginComponent.logo = function(){
|
||||
var style = 'height: 250px; width: 250px; background-size: 250px; background-image: url(images/logosansfond.JPG);';
|
||||
return m('div.uk-cover-background.uk-container-center', {style: style});
|
||||
};
|
||||
|
||||
loginComponent.logoLine = function(){
|
||||
return m('div.uk-grid.uk-margin',
|
||||
m('div.uk-width-1-1', loginComponent.logo()));
|
||||
};
|
||||
|
||||
loginComponent.login = function(ctrl){
|
||||
return function(){
|
||||
var salt = "9'D)E@E{DSq[|l2bq!v";
|
||||
window.secret = salt + ctrl.email() + ctrl.password();
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
loginComponent.formChange = function(ctrl){
|
||||
return function(evt){
|
||||
ctrl[evt.target.name](evt.target.value);
|
||||
};
|
||||
};
|
||||
|
||||
loginComponent.loginForm = function(ctrl){
|
||||
return m('div.uk-panel.uk-panel-box.uk-panel-box-secondary.uk-width-large-1-3.uk-container-center.uk-margin', [
|
||||
m('form.uk-text-center[action]', {onsubmit: loginComponent.login(ctrl), onchange: loginComponent.formChange(ctrl)},
|
||||
m('div.uk-form-row',
|
||||
m('label', "Nom d'utilisateur ",
|
||||
m('input[type=text][name=email][required].uk-form-width-small', {value: ctrl.email()} ))),
|
||||
m('div.uk-form-row',
|
||||
m('label', "Mot de passe ",
|
||||
m('input[type=password][name=password][required].uk-form-width-small', {value: ctrl.password()}))),
|
||||
m('div.uk-form-row', m('button.uk-button', m("i.fa.fa-mars-double"), " Pénétrez"))
|
||||
)
|
||||
]);
|
||||
};
|
||||
|
||||
loginComponent.view = function(ctrl){
|
||||
return m('div', [
|
||||
loginComponent.logoLine(),
|
||||
loginComponent.loginForm(ctrl)
|
||||
]);
|
||||
};
|
||||
|
||||
|
||||
var confidentialPage = {};
|
||||
|
||||
confidentialPage.view = function(){
|
||||
var body;
|
||||
if(!window.secret){
|
||||
body = loginComponent;
|
||||
body = loginPage;
|
||||
}else{
|
||||
body = confidentialPageBody;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user