Extract search results to own template.
Reducing the size and nesting of admin.html.
This commit is contained in:
parent
fc1357aa38
commit
4ea25ec327
@ -140,142 +140,7 @@
|
||||
</form>
|
||||
|
||||
{{ with .SearchResult }}
|
||||
{{ if .Found }}
|
||||
|
||||
<h1>Ticket</h1>
|
||||
|
||||
<table id="ticket-table" class="mt-2 mb-4 w-100">
|
||||
<tr>
|
||||
<th>Hash</th>
|
||||
<td>
|
||||
<a href="{{ txURL .Ticket.Hash }}">
|
||||
{{ .Ticket.Hash }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
{{ if .Ticket.Confirmed }}
|
||||
<td>
|
||||
Confirmed (purchase height:
|
||||
<a href="{{ blockURL .Ticket.PurchaseHeight }}">{{ .Ticket.PurchaseHeight }}</a>)
|
||||
</td>
|
||||
{{ else }}
|
||||
<td>Not confirmed</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Ticket Outcome</th>
|
||||
<td>{{ .Ticket.Outcome }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Commitment Address</th>
|
||||
<td>
|
||||
<a href="{{ addressURL .Ticket.CommitmentAddress }}">
|
||||
{{ .Ticket.CommitmentAddress }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Voting WIF</th>
|
||||
<td>{{ .Ticket.VotingWIF }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h1>Fee</h1>
|
||||
|
||||
<table id="ticket-table" class="mt-2 mb-4 w-100">
|
||||
<tr>
|
||||
<th>Fee Address</th>
|
||||
<td>
|
||||
<a href="{{ addressURL .Ticket.FeeAddress }}">
|
||||
{{ .Ticket.FeeAddress }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Address Index</th>
|
||||
<td>{{ .Ticket.FeeAddressIndex }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Amount</th>
|
||||
<td>{{ atomsToDCR .Ticket.FeeAmount }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Expiration</th>
|
||||
<td>{{ .Ticket.FeeExpiration }} ({{ dateTime .Ticket.FeeExpiration }}) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Tx Hash</th>
|
||||
<td>
|
||||
<a href="{{ txURL .Ticket.FeeTxHash }}">
|
||||
{{ .Ticket.FeeTxHash }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Tx</th>
|
||||
<td>{{ .Ticket.FeeTxHex }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Tx Status</th>
|
||||
<td>{{ .Ticket.FeeTxStatus }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h1>Vote Choices</h1>
|
||||
|
||||
<table id="ticket-table" class="mt-2 mb-4 w-100">
|
||||
<tr>
|
||||
<th>Consensus Vote Choices</th>
|
||||
<td>
|
||||
{{ range $key, $value := .Ticket.VoteChoices }}
|
||||
{{ $key }}: {{ $value }} <br />
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Vote Choice Changes<br />
|
||||
<em>({{ .MaxVoteChanges }} most recent)</em>
|
||||
</th>
|
||||
<td>
|
||||
{{ range $key, $value := .VoteChanges }}
|
||||
<details>
|
||||
<summary>
|
||||
{{ if eq $key 0}}
|
||||
Initial choices
|
||||
{{ else }}
|
||||
Change {{ $key }}
|
||||
{{ end }}
|
||||
</summary>
|
||||
<table class="my-2">
|
||||
<tr>
|
||||
<th>Request</th>
|
||||
<td>{{ indentJSON $value.Request }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Request<br />Signature</th>
|
||||
<td>{{ $value.RequestSignature }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Response</th>
|
||||
<td>{{ indentJSON $value.Response }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Response<br />Signature</th>
|
||||
<td>{{ $value.ResponseSignature }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</details>
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{{ else }}
|
||||
<p>No ticket found with hash <span class="code">{{ .Hash }}</span></p>
|
||||
{{ end }}
|
||||
{{ template "ticket-search-result" . }}
|
||||
{{ end }}
|
||||
</section>
|
||||
|
||||
|
||||
139
webapi/templates/ticket-search-result.html
Normal file
139
webapi/templates/ticket-search-result.html
Normal file
@ -0,0 +1,139 @@
|
||||
{{ define "ticket-search-result" }}
|
||||
|
||||
{{ if .Found }}
|
||||
|
||||
<h1>Ticket</h1>
|
||||
|
||||
<table id="ticket-table" class="mt-2 mb-4 w-100">
|
||||
<tr>
|
||||
<th>Hash</th>
|
||||
<td>
|
||||
<a href="{{ txURL .Ticket.Hash }}">
|
||||
{{ .Ticket.Hash }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
{{ if .Ticket.Confirmed }}
|
||||
<td>
|
||||
Confirmed (purchase height:
|
||||
<a href="{{ blockURL .Ticket.PurchaseHeight }}">{{ .Ticket.PurchaseHeight }}</a>)
|
||||
</td>
|
||||
{{ else }}
|
||||
<td>Not confirmed</td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Ticket Outcome</th>
|
||||
<td>{{ .Ticket.Outcome }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Commitment Address</th>
|
||||
<td>
|
||||
<a href="{{ addressURL .Ticket.CommitmentAddress }}">
|
||||
{{ .Ticket.CommitmentAddress }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Voting WIF</th>
|
||||
<td>{{ .Ticket.VotingWIF }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h1>Fee</h1>
|
||||
|
||||
<table id="ticket-table" class="mt-2 mb-4 w-100">
|
||||
<tr>
|
||||
<th>Fee Address</th>
|
||||
<td>
|
||||
<a href="{{ addressURL .Ticket.FeeAddress }}">
|
||||
{{ .Ticket.FeeAddress }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Address Index</th>
|
||||
<td>{{ .Ticket.FeeAddressIndex }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Amount</th>
|
||||
<td>{{ atomsToDCR .Ticket.FeeAmount }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Expiration</th>
|
||||
<td>{{ .Ticket.FeeExpiration }} ({{ dateTime .Ticket.FeeExpiration }}) </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Tx Hash</th>
|
||||
<td>
|
||||
<a href="{{ txURL .Ticket.FeeTxHash }}">
|
||||
{{ .Ticket.FeeTxHash }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Tx</th>
|
||||
<td>{{ .Ticket.FeeTxHex }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Fee Tx Status</th>
|
||||
<td>{{ .Ticket.FeeTxStatus }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h1>Vote Choices</h1>
|
||||
|
||||
<table id="ticket-table" class="mt-2 mb-4 w-100">
|
||||
<tr>
|
||||
<th>Consensus Vote Choices</th>
|
||||
<td>
|
||||
{{ range $key, $value := .Ticket.VoteChoices }}
|
||||
{{ $key }}: {{ $value }} <br />
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
Vote Choice Changes<br />
|
||||
<em>({{ .MaxVoteChanges }} most recent)</em>
|
||||
</th>
|
||||
<td>
|
||||
{{ range $key, $value := .VoteChanges }}
|
||||
<details>
|
||||
<summary>
|
||||
{{ if eq $key 0}}
|
||||
Initial choices
|
||||
{{ else }}
|
||||
Change {{ $key }}
|
||||
{{ end }}
|
||||
</summary>
|
||||
<table class="my-2">
|
||||
<tr>
|
||||
<th>Request</th>
|
||||
<td>{{ indentJSON $value.Request }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Request<br />Signature</th>
|
||||
<td>{{ $value.RequestSignature }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Response</th>
|
||||
<td>{{ indentJSON $value.Response }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Response<br />Signature</th>
|
||||
<td>{{ $value.ResponseSignature }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</details>
|
||||
{{end}}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
{{ else }}
|
||||
<p>No ticket found with hash <span class="code">{{ .Hash }}</span></p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
Loading…
x
Reference in New Issue
Block a user