Change to query based uri, add new file, success page

This commit is contained in:
Wancat
2022-11-16 02:32:30 +08:00
parent f5ace34852
commit 64b7fa4f50
5 changed files with 15 additions and 22 deletions

View File

@@ -1,18 +1,18 @@
{{ define "title" }}編輯{{ end }}
{{ define "main" }}
<h1>編輯帳本</h1>
<h1>編輯檔案</h1>
<aside>
<ul>
{{ range .FileList }}
<li><a href="/edit/{{ . }}">{{ . }}</a></li>
<li><a href="/edit?filename={{ . }}">{{ . }}</a></li>
{{ end }}
</ul>
<p><a href="/edit">新檔案</a></p>
</aside>
<p>{{ .FileName }}{{ if not .Exists }} - New file{{ end }}</p>
<form action="/edit/{{ .FileName }}" method="POST">
<form action="/edit" method="POST">
<label>Filename: <input type="text" name="filename" value="{{ .FileName }}"></label><br>
<textarea name="data" rows="15" cols="40">{{ .Data }}</textarea><br>
<input type="submit" value="儲存">
<input type="submit" value="{{ if .Exists }}儲存{{ else }}新增{{ end }}">
</form>
{{ end }}