go-watch/templates/viewWatch.html
2022-07-22 19:01:45 +00:00

89 lines
3.3 KiB
HTML

{{define "content"}}
<div class="container">
<div class="row">
<div class="col h1">
{{ .Name }}
</div>
<div class="col h1">
{{ $.Interval }}
</div>
</div>
</div>
{{ range .URLs }}
<div class="card mb-5">
<div class="card-header text-center text-white bg-dark ">
<div class="h5">{{ .Name }}</div>
</div>
<div class="card-header bg-secondary text-white text-center">
<div>{{ .URL }}</div>
</div>
<div class="card-body">
<form action="/query/create" method="post">
<table class="table table-hover caption-top">
<thead>
<tr class="table-secondary">
<th scope="col">Name</th>
<th scope="col">Type</th>
<th scope="col">Query</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
{{ range .Queries }}
<tr>
<td>{{ .Name }}</td>
<td>{{ .Type }}</td>
<td>{{ .Query }}</td>
<td>Delete</td>
</tr>
{{ end }}
<tr>
<td>
<input type="text" class="form-control" name="name" placeholder="Name">
</td>
<td>
<select class="form-control" id="type" name="type">
<option>CSS Selector</option>
<option>XPath</option>
<option>Regex</option>
<option>JSON</option>
</select>
</td>
<td>
<input type="text" class="form-control" name="query" placeholder="Query">
</td>
<td>
<button class="btn btn-primary">Add Query</button>
</td>
</tr>
</tbody>
</table>
<input type="hidden" name="url_id" value="{{ .ID }}" >
<input type="hidden" name="watch_id" value="{{ $.ID }}" >
</form>
</div>
</div>
{{ end }}
<div class="card mb-5">
<div class="card-header text-center bg-light ">
<div class="h5">New URL</div>
</div>
<div class="card-body">
<form action="/url/create" method="post">
<div class="form-group mb-2">
<input type="text" class="form-control" name="name" id="urlName" placeholder="Name">
</div>
<div class="form-group mb-2">
<input type="url" class="form-control" name="url" id="url" placeholder="URL">
</div>
<input type="hidden" name="watch_id" value="{{ .ID }}" >
<input class="btn btn-primary" type="submit" value="Create URL">
</form>
</div>
</div>
{{ end }}