summaryrefslogtreecommitdiff
path: root/views/tm_seed.pug
blob: 81574ca515d9fe448d522214a13899ea461f87ed (plain)
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
//- vim:ts=4:sw=4:
doctype html
html
	head
		include head
		title= seed.seed_name
		style.
			#seed_info td { padding: 2px 10px }
			#seed_info td:first-child { width: 80px }
			#seed_info tr:first-child td { padding-top: 5px }
			#seed_info tr:last-child td { padding-bottom: 5px }
			table { margin: 1em 0 0.5em 0 }
	body
		include header
		article
			h1= seed.seed_name

			div.logo
				+gamecover(seed.title_id)

			if error
				p.error= error

			table#seed_info.half
				tr
					td Format
					td
						a(href="/docs/tournaments.html") Mini Cup
				if seed.scenario !== "Standard"
					tr
						td Scenario
						td #{seed.scenario}
				if seed.options !== "{}"
					tr
						td Options
						td #{format_options(seed.options)}
				if seed.pace
					tr
						td Pace
						td= PACE_ICON[seed.pace]
				tr
					td Players
					td #{seed.pool_size}
				tr
					td Rounds
					if (seed.is_concurrent)
						td #{seed.round_count} concurrent
					else
						td #{seed.round_count} sequential

			if seed.is_open
				each queue,ix in queues
					table.half
						thead
							tr
								if seed.level_count > 1
									th Level #{ix+1}
								else
									th Registered
								td.r #{queue.length}
						tbody
							tr
								if queue.length > 0
									td(colspan=2)!= queue.map(p => `<a class="black" href="/user/${p.name}">${p.name}</a>`).join(", ")
								else
									td Nobody

					if user
						if ix === 0
							if may_register
								if !queue.find(p => p.user_id === user.user_id)
									form(method="post" action="/api/tm/register/" + seed.seed_id)
										button(type="submit") Register
										button(disabled) Withdraw
							else
								div
									button(disabled) Register
									button(disabled) Withdraw

						if queue.find(p => p.user_id === user.user_id)
							form(method="post" action="/api/tm/withdraw/" + seed.seed_id + "/" + (ix+1))
								button(disabled) Register
								button(type="submit") Withdraw

						if user.user_id === 1
							if queue.length >= seed.pool_size
								form(method="post" action="/api/tm/start/" + seed.seed_id + "/" + (ix+1))
									button(type="submit") Start
					else
						p <a href="/login">Login</a> or <a href="/signup">sign up</a> to register.

			+poollist(active_pools, "Active", TM_ICON_ACTIVE)
			+poollist(finished_pools, "Finished", TM_ICON_FINISHED)