diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-09-06 01:09:20 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-09-06 01:09:20 +0900 |
| commit | e7b35cd81f2e515371a30a59ea4173a31dbeefc5 (patch) | |
| tree | 783ef649110730a8946b0021c50688d29b6dab9b /backend/admin/templates | |
| parent | e33bfff4db95586a3140b5e71a7d3dba2c72f694 (diff) | |
| download | iosdc-japan-2025-albatross-e7b35cd81f2e515371a30a59ea4173a31dbeefc5.tar.gz iosdc-japan-2025-albatross-e7b35cd81f2e515371a30a59ea4173a31dbeefc5.tar.zst iosdc-japan-2025-albatross-e7b35cd81f2e515371a30a59ea4173a31dbeefc5.zip | |
feat(backend): add admin page for game creation
Diffstat (limited to 'backend/admin/templates')
| -rw-r--r-- | backend/admin/templates/game_edit.html | 8 | ||||
| -rw-r--r-- | backend/admin/templates/game_new.html | 40 | ||||
| -rw-r--r-- | backend/admin/templates/games.html | 3 |
3 files changed, 49 insertions, 2 deletions
diff --git a/backend/admin/templates/game_edit.html b/backend/admin/templates/game_edit.html index 2d769c4..b171343 100644 --- a/backend/admin/templates/game_edit.html +++ b/backend/admin/templates/game_edit.html @@ -34,8 +34,12 @@ <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 }}"> + <label>Problem</label> + <select name="problem_id" required> + {{ range .Problems }} + <option value="{{ .ProblemID }}"{{ if eq $.Game.ProblemID .ProblemID }} selected{{ end }}>{{ .Title }} (id={{ .ProblemID }})</option> + {{ end }} + </select> </div> <div> <label>Main Player 1</label> diff --git a/backend/admin/templates/game_new.html b/backend/admin/templates/game_new.html new file mode 100644 index 0000000..3e3210a --- /dev/null +++ b/backend/admin/templates/game_new.html @@ -0,0 +1,40 @@ +{{ 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>Display Name</label> + <input type="text" name="display_name" required> + </div> + <div> + <label>Game Type</label> + <select name="game_type" required> + <option value="1v1">1v1</option> + <option value="multiplayer">Multiplayer</option> + </select> + </div> + <div> + <label>Is Public</label> + <input type="checkbox" name="is_public"> + </div> + <div> + <label>Duration Seconds</label> + <input type="number" name="duration_seconds" value="900" required> + </div> + <div> + <label>Problem</label> + <select name="problem_id" required> + {{ range .Problems }} + <option value="{{ .ProblemID }}">{{ .Title }} (id={{ .ProblemID }})</option> + {{ end }} + </select> + </div> + <div> + <button type="submit">Create</button> + </div> +</form> +{{ end }} diff --git a/backend/admin/templates/games.html b/backend/admin/templates/games.html index b5c512a..402c702 100644 --- a/backend/admin/templates/games.html +++ b/backend/admin/templates/games.html @@ -5,6 +5,9 @@ {{ end }} {{ define "content" }} +<div> + <a href="{{ .BasePath }}admin/games/new">Create New Game</a> +</div> <ul> {{ range .Games }} <li> |
