diff options
Diffstat (limited to 'templates/dns.html')
| -rw-r--r-- | templates/dns.html | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/templates/dns.html b/templates/dns.html index 0a40cab..e317d05 100644 --- a/templates/dns.html +++ b/templates/dns.html @@ -5,10 +5,11 @@ <th>Name</th> <th>Content</th> <th>TTL</th> + <th>Delete</th> </tr> {{ if (eq (len .DNSRecords) 0) }} <tr> - <td colspan="4"><span class="blinky">No DNS records found</span></td> + <td colspan="5"><span class="blinky">No DNS records found</span></td> </tr> {{ end }} {{ range $record := .DNSRecords }} @@ -17,21 +18,60 @@ <td>{{ $record.Name }}</td> <td>{{ $record.Content }}</td> <td>{{ $record.TTL }}</td> + <td> + <form method="POST" action="/dns/delete"> + <input type="hidden" name="id" value="{{ $record.ID }}" /> + <input type="submit" value="Delete" /> + </form> + </td> </tr> {{ end }} </table> <br> - <form method="POST" action="/dns"> + <form method="POST" action="/dns" class="form"> <h2>Add DNS Records</h2> + <p>note that the name <em>must</em> be a subdomain of <em>{{ .User.Username }}</em></p> <hr> <label for="type">Type</label> - <input type="text" name="type" placeholder="CNAME" required /> + <input type="text" name="type" placeholder="CNAME" + {{ if not .RecordForm }} + placeholder="CNAME" + {{ else }} + value="{{ .RecordForm.Type }}" + {{ end }} + required /> <label for="name">Name</label> - <input type="text" name="name" placeholder="{{ .User.Username }}" required /> + <input type="text" name="name" + {{ if not .RecordForm }} + placeholder="{{ .User.Username }} || endpoint.{{ .User.Username }}..." + {{ else }} + value="{{ .RecordForm.Name }}" + {{ end }} + required/> <label for="content">Content</label> - <input type="text" name="content" placeholder="{{ .User.Username }}.dev" required /> + <input type="text" name="content" + {{ if not .RecordForm }} + placeholder="{{ .User.Username }}.dev" + {{ else }} + value="{{ .RecordForm.Content }}" + {{ end }} + required /> <label for="ttl">TTL</label> - <input type="text" name="ttl" placeholder="43200" required /> + <input type="text" name="ttl" + {{ if not .RecordForm }} + placeholder="43200" + {{ else }} + value="{{ .RecordForm.TTL }}" + {{ end }} + required /> <input type="submit" value="Add" /> </form> + + {{ if .FormError }} + {{ if (len .FormError.Errors) }} + {{ range $error := .FormError.Errors }} + <div class="error">{{ $error }}</div> + {{ end }} + {{ end }} + {{ end }} {{ end }} |
