-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbracket.ejs
113 lines (95 loc) · 2.9 KB
/
bracket.ejs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tournament Bracket</title>
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css"> -->
<style>
/*
* Flex Layout Specifics
*/
main {
display: flex;
flex-direction: row;
}
.round {
display: flex;
flex-direction: column;
justify-content: center;
width: 200px;
list-style: none;
padding: 0;
}
.round .spacer {
flex-grow: 1;
}
.round .spacer:first-child,
.round .spacer:last-child {
flex-grow: .5;
}
.round .game-spacer {
flex-grow: 1;
}
/*
* General Styles
*/
body {
font-family: sans-serif;
font-size: small;
padding: 10px;
line-height: 1.4em;
}
li.game {
padding-left: 20px;
}
li.game.winner {
font-weight: bold;
}
li.game span {
float: right;
margin-right: 5px;
}
li.game-top {
border-bottom: 1px solid #aaa;
}
li.game-spacer {
border-right: 1px solid #aaa;
min-height: 40px;
}
li.game-bottom {
border-top: 1px solid #aaa;
}
</style>
</head>
<body>
<section class="section">
<div class="container">
<div class="content">
<h1 class="title">
<%=tournament.name%> - <%=tournament.type%>
</h1>
<main id="tournament">
<% Object.keys(rounds).forEach(function(i) { %>
<ul class="round round-<%= i %>">
<li class="spacer"> </li>
<% for (var j=0; j < rounds[i].length; j++) { %>
<li
class="game game-top<% if (rounds[i][j].winner && rounds[i][j].winner.id === rounds[i][j].player1.id) { %> winner<% } %>">
<%= rounds[i][j].player1.name %>
</li>
<li class="game game-spacer"> </li>
<li
class="game game-bottom<% if (rounds[i][j].winner && rounds[i][j].winner.id === rounds[i][j].player2.id) { %> winner<% } %>">
<%= rounds[i][j].player2.name %>
</li>
<li class="spacer"> </li>
<% } %>
</ul>
<% }) %>
</main>
</div>
</div>
</section>
</body>
</html>