aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/admin/templates
diff options
context:
space:
mode:
Diffstat (limited to 'backend/admin/templates')
-rw-r--r--backend/admin/templates/dashboard.html3
-rw-r--r--backend/admin/templates/tournament_edit.html48
-rw-r--r--backend/admin/templates/tournament_new.html22
-rw-r--r--backend/admin/templates/tournaments.html20
4 files changed, 93 insertions, 0 deletions
diff --git a/backend/admin/templates/dashboard.html b/backend/admin/templates/dashboard.html
index 5a7b484..2e9336a 100644
--- a/backend/admin/templates/dashboard.html
+++ b/backend/admin/templates/dashboard.html
@@ -11,6 +11,9 @@
<a href="{{ .BasePath }}admin/problems">Problems</a>
</p>
<p>
+ <a href="{{ .BasePath }}admin/tournaments">Tournaments</a>
+</p>
+<p>
<a href="{{ .BasePath }}admin/online-qualifying-ranking">Online Qualifying Ranking</a>
</p>
<form method="post" action="{{ .BasePath }}admin/fix">
diff --git a/backend/admin/templates/tournament_edit.html b/backend/admin/templates/tournament_edit.html
new file mode 100644
index 0000000..6c1ad6c
--- /dev/null
+++ b/backend/admin/templates/tournament_edit.html
@@ -0,0 +1,48 @@
+{{ template "base.html" . }}
+
+{{ define "breadcrumb" }}
+<a href="{{ .BasePath }}admin/dashboard">Dashboard</a> | <a href="{{ .BasePath }}admin/tournaments">Tournaments</a>
+{{ end }}
+
+{{ define "content" }}
+<form method="post">
+ <div>
+ <label>Display Name</label>
+ <input type="text" name="display_name" value="{{ .Tournament.DisplayName }}" required>
+ </div>
+
+ <h3>Bracket (size={{ .Tournament.BracketSize }}, rounds={{ .Tournament.NumRounds }})</h3>
+
+ <h3>Entries (seed → user)</h3>
+ {{ range .Seeds }}
+ {{ $seed := . }}
+ <div>
+ <label>Seed {{ $seed }}</label>
+ <select name="seed_{{ $seed }}">
+ <option value="0">-- none (bye) --</option>
+ {{ range $.Users }}
+ <option value="{{ .UserID }}" {{ if eq .UserID (index $.SeedUserMap $seed) }}selected{{ end }}>{{ .Username }} (id={{ .UserID }})</option>
+ {{ end }}
+ </select>
+ </div>
+ {{ end }}
+
+ <h3>Matches (game assignment)</h3>
+ {{ range .Matches }}
+ <div>
+ <label>Round {{ .Round }} Pos {{ .Position }} ({{ .Description }})</label>
+ {{ $matchID := .MatchID }}
+ <select name="match_{{ $matchID }}">
+ <option value="0">-- no game --</option>
+ {{ range $.Games }}
+ <option value="{{ .GameID }}" {{ if eq .GameID (index $.MatchGameMap $matchID) }}selected{{ end }}>{{ .DisplayName }} (id={{ .GameID }})</option>
+ {{ end }}
+ </select>
+ </div>
+ {{ end }}
+
+ <div>
+ <button type="submit">Save</button>
+ </div>
+</form>
+{{ end }}
diff --git a/backend/admin/templates/tournament_new.html b/backend/admin/templates/tournament_new.html
new file mode 100644
index 0000000..14b0c4c
--- /dev/null
+++ b/backend/admin/templates/tournament_new.html
@@ -0,0 +1,22 @@
+{{ template "base.html" . }}
+
+{{ define "breadcrumb" }}
+<a href="{{ .BasePath }}admin/dashboard">Dashboard</a> | <a href="{{ .BasePath }}admin/tournaments">Tournaments</a>
+{{ end }}
+
+{{ define "content" }}
+<form method="post">
+ <div>
+ <label>Display Name</label>
+ <input type="text" name="display_name" required>
+ </div>
+ <div>
+ <label>Number of Participants</label>
+ <input type="number" name="num_participants" min="2" max="64" value="4" required>
+ <small>Bracket size will be rounded up to next power of 2.</small>
+ </div>
+ <div>
+ <button type="submit">Create</button>
+ </div>
+</form>
+{{ end }}
diff --git a/backend/admin/templates/tournaments.html b/backend/admin/templates/tournaments.html
new file mode 100644
index 0000000..09989a2
--- /dev/null
+++ b/backend/admin/templates/tournaments.html
@@ -0,0 +1,20 @@
+{{ template "base.html" . }}
+
+{{ define "breadcrumb" }}
+<a href="{{ .BasePath }}admin/dashboard">Dashboard</a>
+{{ end }}
+
+{{ define "content" }}
+<div>
+ <a href="{{ .BasePath }}admin/tournaments/new">Create New Tournament</a>
+</div>
+<ul>
+ {{ range .Tournaments }}
+ <li>
+ <a href="{{ $.BasePath }}admin/tournaments/{{ .TournamentID }}">
+ {{ .DisplayName }} (id={{ .TournamentID }} bracket_size={{ .BracketSize }})
+ </a>
+ </li>
+ {{ end }}
+</ul>
+{{ end }}