aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/admin/templates/game_edit.html
blob: 0d92c958fa8547185675286b4740f2411e040063 (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
{{ template "base.html" . }}

{{ define "breadcrumb" }}
<a href="{{ .BasePath }}/admin/dashboard">Dashboard</a> | <a href="{{ .BasePath }}/admin/games">Games</a>
{{ end }}

{{ define "content" }}
<form method="post">
  <div>
    <label>Game ID</label>
    <input type="text" name="game_id" value="{{ .Game.GameID }}" readonly required>
  </div>
  <div>
    <label>Display Name</label>
    <input type="text" name="display_name" value="{{ .Game.DisplayName }}" required>
  </div>
  <div>
    <label>Game Type</label>
    <select name="game_type" required>
      <option value="1v1"{{ if eq .Game.GameType "1v1" }} selected{{ end }}>1v1</option>
      <option value="multiplayer"{{ if eq .Game.GameType "multiplayer" }} selected{{ end }}>Multiplayer</option>
    </select>
  </div>
  <div>
    <label>Is Public</label>
    <input type="checkbox" name="is_public"{{ if .Game.IsPublic }} checked{{ end }}>
  </div>
  <div>
    <label>Duration Seconds</label>
    <input type="number" name="duration_seconds" value="{{ .Game.DurationSeconds }}" required>
  </div>
  <div>
    <label>Started At</label>
    <input type="datetime-local" name="started_at" value="{{ if .Game.StartedAt }}{{ .Game.StartedAt }}{{ end }}">
  </div>
  <div>
    <label>Problem ID</label>
    <input type="text" name="problem_id" value="{{ .Game.ProblemID }}">
  </div>
  <div>
    <label>Main Player 1</label>
    <select name="main_player_1">
      <option value="0"{{ if eq $.Game.MainPlayer1 0 }} selected{{ end }}>none</option>
      {{ range .Users }}
        <option value="{{ .UserID }}"{{ if eq $.Game.MainPlayer1 .UserID }} selected{{ end }}>{{ .Username }} (uid={{ .UserID }})</option>
      {{ end }}
    </select>
  </div>
  <div>
    <label>Main Player 2</label>
    <select name="main_player_2">
      <option value="0"{{ if eq $.Game.MainPlayer2 0 }} selected{{ end }}>none</option>
      {{ range .Users }}
        <option value="{{ .UserID }}"{{ if eq $.Game.MainPlayer2 .UserID }} selected{{ end }}>{{ .Username }} (uid={{ .UserID }})</option>
      {{ end }}
    </select>
  </div>
  <div>
    <button type="submit">Save</button>
  </div>
  <div>
    <button type="submit" formaction="{{ .BasePath }}/admin/games/{{ .Game.GameID }}/start">Start</button>
  </div>
</form>
{{ end }}