hatecomputers.club/templates/kennel.html

82 lines
2.1 KiB
HTML

{{ define "content" }}
<table>
<tr>
<th>type.</th>
<th>name.</th>
<th>content.</th>
<th>ttl.</th>
<th>internal.</th>
<th>created.</th>
<th>delete.</th>
</tr>
{{ if (eq (len .DNSRecords) 0) }}
<tr>
<td colspan="7"><span class="blinky">no dns records found.</span></td>
</tr>
{{ end }}
{{ range $record := .DNSRecords }}
<tr>
<td>{{ $record.Type }}</td>
<td>{{ $record.Name }}</td>
<td>{{ $record.Content }}</td>
<td>{{ $record.TTL }}</td>
<td>{{ $record.Internal }}</td>
<td class="time">{{ $record.CreatedAt }}</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" 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"
{{ if not .RecordForm }}
placeholder="CNAME"
{{ else }}
value="{{ .RecordForm.Type }}"
{{ end }}
required />
<label for="name">name.</label>
<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"
{{ if not .RecordForm }}
placeholder="{{ .User.Username }}.dev"
{{ else }}
value="{{ .RecordForm.Content }}"
{{ end }}
required />
<label for="ttl">ttl.</label>
<input type="text" name="ttl"
{{ if not .RecordForm }}
placeholder="43200"
{{ else }}
value="{{ .RecordForm.TTL }}"
{{ end }}
required />
<label for="internal">
internal.
<input style='display:inline;width:auto;' type="checkbox" name="internal"
{{ if .RecordForm.Internal }}
checked
{{ end }}
/>
</label>
<input type="submit" value="add." />
</form>
{{ end }}