diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-04 14:50:30 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-04 16:59:10 +0900 |
| commit | 264fa15fb2ba5f0b9636cda44b64deb3c56aa99d (patch) | |
| tree | 61de974c9ed1aa5b94b6d5900fdb8e3a2d4b3efd /backend/admin/templates | |
| parent | 1b794787a5194405cd99d80981008e20aa0e953d (diff) | |
| download | phperkaigi-2025-albatross-264fa15fb2ba5f0b9636cda44b64deb3c56aa99d.tar.gz phperkaigi-2025-albatross-264fa15fb2ba5f0b9636cda44b64deb3c56aa99d.tar.zst phperkaigi-2025-albatross-264fa15fb2ba5f0b9636cda44b64deb3c56aa99d.zip | |
feat(backend): serve /admin/* pages from api-server
Diffstat (limited to 'backend/admin/templates')
| -rw-r--r-- | backend/admin/templates/base.html | 25 | ||||
| -rw-r--r-- | backend/admin/templates/dashboard.html | 10 | ||||
| -rw-r--r-- | backend/admin/templates/game_edit.html | 45 | ||||
| -rw-r--r-- | backend/admin/templates/games.html | 17 | ||||
| -rw-r--r-- | backend/admin/templates/user_edit.html | 33 | ||||
| -rw-r--r-- | backend/admin/templates/users.html | 17 |
6 files changed, 147 insertions, 0 deletions
diff --git a/backend/admin/templates/base.html b/backend/admin/templates/base.html new file mode 100644 index 0000000..4bcdbdd --- /dev/null +++ b/backend/admin/templates/base.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> +<head> + <title>ADMIN {{ .Title }} | iOSDC Japan 2024 Albatross.swift</title> + <link rel="icon" href="/favicon.svg"> + <link rel="stylesheet" href="/admin/css/normalize.css"> + <link rel="stylesheet" href="/admin/css/sakura.css"> +</head> +<body> + <section> + <h1>ADMIN {{ .Title }}</h1> + <p> + <em>This is an admin page.</em> + </p> + <section> + <nav> + {{ block "breadcrumb" . }}{{ end }} + </nav> + </section> + <section> + {{ block "content" . }}{{ end }} + </section> + </section> +</body> +</html> diff --git a/backend/admin/templates/dashboard.html b/backend/admin/templates/dashboard.html new file mode 100644 index 0000000..2d7e8ad --- /dev/null +++ b/backend/admin/templates/dashboard.html @@ -0,0 +1,10 @@ +{{ template "base.html" . }} + +{{ define "content" }} +<p> + <a href="/admin/users">Users</a> +</p> +<p> + <a href="/admin/games">Games</a> +</p> +{{ end }} diff --git a/backend/admin/templates/game_edit.html b/backend/admin/templates/game_edit.html new file mode 100644 index 0000000..8bc5410 --- /dev/null +++ b/backend/admin/templates/game_edit.html @@ -0,0 +1,45 @@ +{{ template "base.html" . }} + +{{ define "breadcrumb" }} +<a href="/admin/dashboard">Dashboard</a> | <a href="/admin/games">Games</a> +{{ end }} + +{{ define "content" }} +<form> + <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>State</label> + <select> + <option value="closed"{{ if eq .Game.State "closed" }} selected{{ end }}>Closed</option> + <option value="waiting_entries"{{ if eq .Game.State "waiting_entries" }} selected{{ end }}>WaitingEntries</option> + <option value="waiting_start"{{ if eq .Game.State "waiting_start" }} selected{{ end }}>WaitingStart</option> + <option value="prepare"{{ if eq .Game.State "prepare" }} selected{{ end }}>Prepare</option> + <option value="starting"{{ if eq .Game.State "starting" }} selected{{ end }}>Starting</option> + <option value="gaming"{{ if eq .Game.State "gaming" }} selected{{ end }}>Gaming</option> + <option value="finished"{{ if eq .Game.State "finished" }} selected{{ end }}>Finished</option> + </select> + </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="{{ .Game.StartedAt }}"> + </div> + <div> + <label>Problem ID</label> + <input type="text" name="problem_id" value="{{ .Game.ProblemID }}" disabled> + </div> + <div> + <button type="submit">Save</button> + </div> +</form> +{{ end }} diff --git a/backend/admin/templates/games.html b/backend/admin/templates/games.html new file mode 100644 index 0000000..244fc94 --- /dev/null +++ b/backend/admin/templates/games.html @@ -0,0 +1,17 @@ +{{ template "base.html" . }} + +{{ define "breadcrumb" }} +<a href="/admin/dashboard">Dashboard</a> +{{ end }} + +{{ define "content" }} +<ul> + {{ range .Games }} + <li> + <a href="/admin/games/{{ .GameID }}"> + {{ .DisplayName }} (id={{ .GameID }}) + </a> + </li> + {{ end }} +</ul> +{{ end }} diff --git a/backend/admin/templates/user_edit.html b/backend/admin/templates/user_edit.html new file mode 100644 index 0000000..9089b1e --- /dev/null +++ b/backend/admin/templates/user_edit.html @@ -0,0 +1,33 @@ +{{ template "base.html" . }} + +{{ define "breadcrumb" }} +<a href="/admin/dashboard">Dashboard</a> | <a href="/admin/users">Users</a> +{{ end }} + +{{ define "content" }} +<form> + <div> + <label>User ID</label> + <input type="text" name="user_id" value="{{ .User.UserID }}" readonly required> + </div> + <div> + <label>Username</label> + <input type="text" name="username" value="{{ .User.Username }}" readonly required> + </div> + <div> + <label>Display Name</label> + <input type="text" name="display_name" value="{{ .User.DisplayName }}" required> + </div> + <div> + <label>Icon Path</label> + <input type="text" name="icon_path" value="{{ .User.IconPath }}"> + </div> + <div> + <label>Is Admin</label> + <input type="checkbox" name="is_admin"{{ if .User.IsAdmin }} checked{{ end }}> + </div> + <div> + <button type="submit">Save</button> + </div> +</form> +{{ end }} diff --git a/backend/admin/templates/users.html b/backend/admin/templates/users.html new file mode 100644 index 0000000..656ad53 --- /dev/null +++ b/backend/admin/templates/users.html @@ -0,0 +1,17 @@ +{{ template "base.html" . }} + +{{ define "breadcrumb" }} +<a href="/admin/dashboard">Dashboard</a> +{{ end }} + +{{ define "content" }} +<ul> + {{ range .Users }} + <li> + <a href="/admin/users/{{ .UserID }}"> + {{ .DisplayName }} (id={{ .UserID }} username={{ .Username }}){{ if .IsAdmin }} <em>admin</em>{{ end }} + </a> + </li> + {{ end }} +</ul> +{{ end }} |
