Lablenames and more
This commit is contained in:
@ -2,6 +2,9 @@
|
||||
// This is the backend client js
|
||||
let iosocket = io.connect();
|
||||
|
||||
let tbdLable = 'To be determined',
|
||||
noTeam = 'Kein Team';
|
||||
|
||||
// setup all my handlers
|
||||
iosocket.on('clientrefresh', () => {
|
||||
location.reload();
|
||||
@ -18,20 +21,16 @@ iosocket.on('stateChange', (state) => {
|
||||
}
|
||||
});
|
||||
|
||||
$('.increment').click(function(){
|
||||
$('.increment').click(function() {
|
||||
alert('haha');
|
||||
// trigger a state update?
|
||||
});
|
||||
$('.decrement').click(function(){
|
||||
$('.decrement').click(function() {
|
||||
alert('haha');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
// get my state
|
||||
let context = 'admin';
|
||||
iosocket.emit('loadState', context);
|
||||
|
||||
|
||||
|
||||
// Bracket editing
|
||||
|
||||
@ -39,8 +38,8 @@ iosocket.emit('loadState', context);
|
||||
/* Custom data objects passed as teams */
|
||||
var customData = {
|
||||
teams: [
|
||||
["Team 1","Team 2"],
|
||||
["Team 3","Team 4"]
|
||||
["Team 1", "Team 2"],
|
||||
["Team 3", "Team 4"]
|
||||
],
|
||||
results: []
|
||||
}
|
||||
@ -73,27 +72,36 @@ function edit_fn(container, data, doneCb) {
|
||||
function render_fn(container, data, score, state) {
|
||||
switch (state) {
|
||||
case "empty-bye":
|
||||
container.append("No team")
|
||||
container.append(noTeam)
|
||||
return;
|
||||
case "empty-tbd":
|
||||
container.append("Upcoming")
|
||||
container.append("To be determined")
|
||||
return;
|
||||
|
||||
case "entry-no-score":
|
||||
console.log('no score');// no return
|
||||
case "entry-default-win":
|
||||
console.log('default win');// no return
|
||||
case "entry-complete":
|
||||
container.append(data);
|
||||
return;
|
||||
}
|
||||
console.log(container);
|
||||
}
|
||||
|
||||
function saveFn(data, userData) {
|
||||
iosocket.emit('editState', data);
|
||||
}
|
||||
|
||||
|
||||
$(function() {
|
||||
$('#refresh').click(function(){
|
||||
// Dom is loaded
|
||||
$('#refresh').click(function() {
|
||||
iosocket.emit('clientrefresh');
|
||||
});
|
||||
// Reading config (not state) from dom... and after all jquery is a doomed dom lib
|
||||
tbdLable = $('#TBD').val();
|
||||
noTeam = $('#NoT').val();
|
||||
|
||||
// get my state
|
||||
let context = 'admin';
|
||||
iosocket.emit('loadState', context);
|
||||
});
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
let iosocket = io.connect();
|
||||
|
||||
let tbdLable = 'To be determined',
|
||||
noTeam = 'Kein Team';
|
||||
|
||||
// setup all my handlers
|
||||
iosocket.on('clientrefresh', () => {
|
||||
location.reload();
|
||||
@ -11,11 +14,38 @@ iosocket.on('stateChange', (state) => {
|
||||
console.log(state);
|
||||
// basically the server tracks the state since it is the same for al clients
|
||||
// So we know that we HAVE to update at this point
|
||||
$('#team-container').bracket({init: state});
|
||||
$('#team-container').bracket({
|
||||
init: state,
|
||||
decorator: {
|
||||
edit: ()=>{},
|
||||
render: render_fn
|
||||
}
|
||||
});
|
||||
});
|
||||
function lolz() {
|
||||
}
|
||||
function render_fn(container, data, score, state) {
|
||||
switch (state) {
|
||||
case "empty-bye":
|
||||
container.append(noTeam)
|
||||
return;
|
||||
case "empty-tbd":
|
||||
container.append(tbdLable)
|
||||
retrun;
|
||||
case "entry-no-score":
|
||||
console.log('no score');// no return
|
||||
case "entry-default-win":
|
||||
console.log('default win');// no return
|
||||
case "entry-complete":
|
||||
container.append(data);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$( document ).ready(function() {
|
||||
tbdLable = $('#TBD').val();
|
||||
noTeam = $('#NoT').val();
|
||||
// get my state
|
||||
let context = 'main';
|
||||
iosocket.emit('loadState',context);
|
||||
|
Reference in New Issue
Block a user