Migrate to layout

This commit is contained in:
Wancat
2022-10-20 11:20:24 +08:00
parent ab43f732fe
commit 526a1c4faa
6 changed files with 79 additions and 64 deletions

View File

@@ -1,27 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title>Ledger Quick Note</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Ledger Quick Note</h1>
<form action="/new" method="POST">
<label>Action:
{{ range .Templates }}
<input type="radio" name="action" value="{{ .Name }}">{{ .Name }}</option>
{{ end }}
</label><br>
<label>Amount: <input name="amount" type="number"></label><br>
<label>Account: <input name="account" type="text"></label></br>
<label>Tx Name: <input name="name" type="text"></label></br>
<input type="submit">
</form>
<h2>Scripts</h2>
<ul>
{{ range $k, $v := .Scripts }}
<li><a href="/exec?name={{ $k }}">{{ $k }}</a></li>
{{ end }}
</ul>
</body>
</html>
{{ define "main" }}
<h1>Ledger Quick Note</h1>
<form action="/new" method="POST">
<label>Action:
{{ range .Templates }}
<input type="radio" name="action" value="{{ .Name }}">{{ .Name }}</option>
{{ end }}
</label><br>
<label>Amount: <input name="amount" type="number"></label><br>
<label>Account: <input name="account" type="text"></label></br>
<label>Tx Name: <input name="name" type="text"></label></br>
<input type="submit">
</form>
<h2>Scripts</h2>
<ul>
{{ range $k, $v := .Scripts }}
<li><a href="/exec?name={{ $k }}">{{ $k }}</a></li>
{{ end }}
</ul>
{{ end }}

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>{{ block "title" . }}Ledger Quick Note{{ end }}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
{{ block "main" . }}
{{ end }}
</body>
</html>

View File

@@ -1,14 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<title>Ledger Quick Note</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Confirm new Tx</h1>
<form action="/submit" method="POST">
<textarea name="tx" rows="15" cols="40">{{ .Tx }}</textarea><br>
<input type="submit">
</form>
</body>
</html>
{{ define "title" }}Confirm{{ end }}
{{ define "main" }}
<h1>Confirm new Tx</h1>
<form action="/submit" method="POST">
<textarea name="tx" rows="15" cols="40">{{ .Tx }}</textarea><br>
<input type="submit">
</form>
{{ end }}

View File

@@ -1,13 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<title>Ledger Quick Note</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>Ledger Quick Note</h1>
<p><strong>Success</strong></p>
<pre><code>{{ .Tx }}</code></pre>
<p><a href="/">Back to home</a></p>
</body>
</html>
{{ define "title" }}Success{{ end }}
{{ define "main" }}
<p><strong>Success</strong></p>
<pre><code>{{ .Tx }}</code></pre>
<p><a href="/">Back to home</a></p>
{{ end }}