aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/admin/templates
diff options
context:
space:
mode:
Diffstat (limited to 'backend/admin/templates')
-rw-r--r--backend/admin/templates/problem_edit.html6
-rw-r--r--backend/admin/templates/testcase_edit.html36
-rw-r--r--backend/admin/templates/testcase_new.html27
-rw-r--r--backend/admin/templates/testcases.html26
4 files changed, 95 insertions, 0 deletions
diff --git a/backend/admin/templates/problem_edit.html b/backend/admin/templates/problem_edit.html
index cc700f4..722473b 100644
--- a/backend/admin/templates/problem_edit.html
+++ b/backend/admin/templates/problem_edit.html
@@ -33,4 +33,10 @@
<button type="submit">Save</button>
</div>
</form>
+<div>
+ <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}/testcases">View Testcases</a>
+</div>
+<div>
+ <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}/testcases/new">Add New Testcase</a>
+</div>
{{ end }}
diff --git a/backend/admin/templates/testcase_edit.html b/backend/admin/templates/testcase_edit.html
new file mode 100644
index 0000000..65e181e
--- /dev/null
+++ b/backend/admin/templates/testcase_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> | <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}">{{ .Problem.Title }}</a> | <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}/testcases">Testcases</a>
+{{ end }}
+
+{{ define "content" }}
+<h2>Edit Testcase for {{ .Problem.Title }}</h2>
+<form method="post">
+ <div>
+ <label>Testcase ID</label>
+ <input type="text" name="testcase_id" value="{{ .Testcase.TestcaseID }}" readonly required>
+ </div>
+ <div>
+ <label>Problem</label>
+ <input type="text" value="{{ .Problem.Title }}" readonly>
+ <input type="hidden" name="problem_id" value="{{ .Problem.ProblemID }}">
+ </div>
+ <div>
+ <label>Stdin</label>
+ <textarea name="stdin" rows="10" required>{{ .Testcase.Stdin }}</textarea>
+ </div>
+ <div>
+ <label>Stdout</label>
+ <textarea name="stdout" rows="10" required>{{ .Testcase.Stdout }}</textarea>
+ </div>
+ <div>
+ <button type="submit">Save</button>
+ </div>
+</form>
+<form method="post" action="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}/testcases/{{ .Testcase.TestcaseID }}/delete" onsubmit="return confirm('Are you sure you want to delete this testcase?');">
+ <div>
+ <button type="submit">Delete</button>
+ </div>
+</form>
+{{ end }}
diff --git a/backend/admin/templates/testcase_new.html b/backend/admin/templates/testcase_new.html
new file mode 100644
index 0000000..828406a
--- /dev/null
+++ b/backend/admin/templates/testcase_new.html
@@ -0,0 +1,27 @@
+{{ template "base.html" . }}
+
+{{ define "breadcrumb" }}
+<a href="{{ .BasePath }}admin/dashboard">Dashboard</a> | <a href="{{ .BasePath }}admin/problems">Problems</a> | <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}">{{ .Problem.Title }}</a> | <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}/testcases">Testcases</a>
+{{ end }}
+
+{{ define "content" }}
+<h2>New Testcase for {{ .Problem.Title }}</h2>
+<form method="post">
+ <div>
+ <label>Problem</label>
+ <input type="text" value="{{ .Problem.Title }}" readonly>
+ <input type="hidden" name="problem_id" value="{{ .Problem.ProblemID }}">
+ </div>
+ <div>
+ <label>Stdin</label>
+ <textarea name="stdin" rows="10" required></textarea>
+ </div>
+ <div>
+ <label>Stdout</label>
+ <textarea name="stdout" rows="10" required></textarea>
+ </div>
+ <div>
+ <button type="submit">Create</button>
+ </div>
+</form>
+{{ end }}
diff --git a/backend/admin/templates/testcases.html b/backend/admin/templates/testcases.html
new file mode 100644
index 0000000..c27a45f
--- /dev/null
+++ b/backend/admin/templates/testcases.html
@@ -0,0 +1,26 @@
+{{ template "base.html" . }}
+
+{{ define "breadcrumb" }}
+<a href="{{ .BasePath }}admin/dashboard">Dashboard</a> | <a href="{{ .BasePath }}admin/problems">Problems</a> | <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}">{{ .Problem.Title }}</a>
+{{ end }}
+
+{{ define "content" }}
+<h2>Testcases for {{ .Problem.Title }}</h2>
+<div>
+ <a href="{{ .BasePath }}admin/problems/{{ .Problem.ProblemID }}/testcases/new">Create New Testcase</a>
+</div>
+{{ range .Testcases }}
+ <h3>{{ .TestcaseID }}</h3>
+ <div>
+ <a href="{{ $.BasePath }}admin/problems/{{ $.Problem.ProblemID }}/testcases/{{ .TestcaseID }}">Edit</a>
+ </div>
+ <h4>Stdin</h4>
+ <div>
+ <pre><code>{{ .Stdin }}</code></pre>
+ </div>
+ <h4>Stdout</h4>
+ <div>
+ <pre><code>{{ .Stdout }}</code></pre>
+ </div>
+{{ end }}
+{{ end }}