aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/admin/templates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-06 00:32:03 +0900
committernsfisis <nsfisis@gmail.com>2025-09-06 00:32:03 +0900
commite33bfff4db95586a3140b5e71a7d3dba2c72f694 (patch)
treee469dee99215bb888c3dd3f30d0c3cfba0f669d0 /backend/admin/templates
parent94d03dc712aff58e7594e7af38e0b6881238c778 (diff)
downloadiosdc-japan-2025-albatross-e33bfff4db95586a3140b5e71a7d3dba2c72f694.tar.gz
iosdc-japan-2025-albatross-e33bfff4db95586a3140b5e71a7d3dba2c72f694.tar.zst
iosdc-japan-2025-albatross-e33bfff4db95586a3140b5e71a7d3dba2c72f694.zip
feat(backend): add admin page for problems
Diffstat (limited to 'backend/admin/templates')
-rw-r--r--backend/admin/templates/dashboard.html3
-rw-r--r--backend/admin/templates/problem_edit.html36
-rw-r--r--backend/admin/templates/problem_new.html32
-rw-r--r--backend/admin/templates/problems.html20
4 files changed, 91 insertions, 0 deletions
diff --git a/backend/admin/templates/dashboard.html b/backend/admin/templates/dashboard.html
index dcc71ba..1ea40c9 100644
--- a/backend/admin/templates/dashboard.html
+++ b/backend/admin/templates/dashboard.html
@@ -8,6 +8,9 @@
<a href="{{ .BasePath }}admin/games">Games</a>
</p>
<p>
+ <a href="{{ .BasePath }}admin/problems">Problems</a>
+</p>
+<p>
<a href="{{ .BasePath }}admin/online-qualifying-ranking?game_1=7&game_2=8">Online Qualifying Ranking</a>
</p>
<form method="post" action="{{ .BasePath }}admin/fix">
diff --git a/backend/admin/templates/problem_edit.html b/backend/admin/templates/problem_edit.html
new file mode 100644
index 0000000..cc700f4
--- /dev/null
+++ b/backend/admin/templates/problem_edit.html
@@ -0,0 +1,36 @@
+{{ template "base.html" . }}
+
+{{ define "breadcrumb" }}
+<a href="{{ .BasePath }}admin/dashboard">Dashboard</a> | <a href="{{ .BasePath }}admin/problems">Problems</a>
+{{ end }}
+
+{{ define "content" }}
+<form method="post">
+ <div>
+ <label>Problem ID</label>
+ <input type="text" name="problem_id" value="{{ .Problem.ProblemID }}" readonly required>
+ </div>
+ <div>
+ <label>Title</label>
+ <input type="text" name="title" value="{{ .Problem.Title }}" required>
+ </div>
+ <div>
+ <label>Description</label>
+ <textarea name="description" rows="10" required>{{ .Problem.Description }}</textarea>
+ </div>
+ <div>
+ <label>Language</label>
+ <select name="language" required>
+ <option value="php"{{ if eq .Problem.Language "php" }} selected{{ end }}>PHP</option>
+ <option value="swift"{{ if eq .Problem.Language "swift" }} selected{{ end }}>Swift</option>
+ </select>
+ </div>
+ <div>
+ <label>Sample Code</label>
+ <textarea name="sample_code" rows="15" required>{{ .Problem.SampleCode }}</textarea>
+ </div>
+ <div>
+ <button type="submit">Save</button>
+ </div>
+</form>
+{{ end }}
diff --git a/backend/admin/templates/problem_new.html b/backend/admin/templates/problem_new.html
new file mode 100644
index 0000000..ed8ad2a
--- /dev/null
+++ b/backend/admin/templates/problem_new.html
@@ -0,0 +1,32 @@
+{{ template "base.html" . }}
+
+{{ define "breadcrumb" }}
+<a href="{{ .BasePath }}admin/dashboard">Dashboard</a> | <a href="{{ .BasePath }}admin/problems">Problems</a>
+{{ end }}
+
+{{ define "content" }}
+<form method="post">
+ <div>
+ <label>Title</label>
+ <input type="text" name="title" required>
+ </div>
+ <div>
+ <label>Description</label>
+ <textarea name="description" rows="10" required></textarea>
+ </div>
+ <div>
+ <label>Language</label>
+ <select name="language" required>
+ <option value="php">PHP</option>
+ <option value="swift">Swift</option>
+ </select>
+ </div>
+ <div>
+ <label>Sample Code</label>
+ <textarea name="sample_code" rows="15" required></textarea>
+ </div>
+ <div>
+ <button type="submit">Create</button>
+ </div>
+</form>
+{{ end }}
diff --git a/backend/admin/templates/problems.html b/backend/admin/templates/problems.html
new file mode 100644
index 0000000..120789e
--- /dev/null
+++ b/backend/admin/templates/problems.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/problems/new">Create New Problem</a>
+</div>
+<ul>
+ {{ range .Problems }}
+ <li>
+ <a href="{{ $.BasePath }}admin/problems/{{ .ProblemID }}">
+ {{ .Title }} (id={{ .ProblemID }} language={{ .Language }})
+ </a>
+ </li>
+ {{ end }}
+</ul>
+{{ end }}