Highlight inputs/outputs of shown address

This commit is contained in:
Martin Boehm 2018-07-02 14:41:37 +02:00
parent 7e68630377
commit 6fb71a7734
2 changed files with 7 additions and 6 deletions

View File

@ -102,6 +102,7 @@ func parseTemplates() (txTpl, addressTpl *template.Template) {
"formatUnixTime": formatUnixTime, "formatUnixTime": formatUnixTime,
"formatAmount": formatAmount, "formatAmount": formatAmount,
"setTxToTemplateData": setTxToTemplateData, "setTxToTemplateData": setTxToTemplateData,
"stringInSlice": stringInSlice,
} }
txTpl = template.Must(template.New("tx").Funcs(templateFuncMap).ParseFiles("./static/templates/tx.html", "./static/templates/txdetail.html", "./static/templates/base.html")) txTpl = template.Must(template.New("tx").Funcs(templateFuncMap).ParseFiles("./static/templates/tx.html", "./static/templates/txdetail.html", "./static/templates/base.html"))
addressTpl = template.Must(template.New("address").Funcs(templateFuncMap).ParseFiles("./static/templates/address.html", "./static/templates/txdetail.html", "./static/templates/base.html")) addressTpl = template.Must(template.New("address").Funcs(templateFuncMap).ParseFiles("./static/templates/address.html", "./static/templates/txdetail.html", "./static/templates/base.html"))

View File

@ -18,11 +18,10 @@
<td> <td>
{{if $vin.Txid}} {{if $vin.Txid}}
<span class="float-left ellipsis"> <span class="float-left ellipsis">
{{if $vin.Addr}} {{if $vin.Addr}}{{if eq $vin.Addr $addr}}{{$vin.Addr}}{{else}}
<a href="/explorer/address/{{$vin.Addr}}">{{$vin.Addr}}</a> <a href="/explorer/address/{{$vin.Addr}}">{{$vin.Addr}}</a>{{end}}{{else}}Unparsed address{{end}}
{{else}}Unparsed address{{end}}
</span> </span>
<span class="float-right"> {{formatAmount $vin.Value}} {{$cs}} </span> <span class="float-right{{if eq $vin.Addr $addr}} text-danger{{end}}">{{formatAmount $vin.Value}} {{$cs}}</span>
{{else}}No Inputs (Newly Generated Coins){{end}} {{else}}No Inputs (Newly Generated Coins){{end}}
</td> </td>
</tr> </tr>
@ -45,12 +44,13 @@
<td> <td>
{{range $a := $vout.ScriptPubKey.Addresses}} {{range $a := $vout.ScriptPubKey.Addresses}}
<span class="ellipsis float-left"> <span class="ellipsis float-left">
<a href="/explorer/address/{{$a}}">{{$a}}</a> {{if eq $a $addr}}{{$a}}{{else}}
<a href="/explorer/address/{{$a}}">{{$a}}</a>{{end}}
</span> </span>
{{else}} {{else}}
<span class="float-left">Unparsed address</span> <span class="float-left">Unparsed address</span>
{{end}} {{end}}
<span class="float-right">{{formatAmount $vout.Value}} {{$cs}}</span> <span class="float-right{{if stringInSlice $addr $vout.ScriptPubKey.Addresses}} text-success{{end}}">{{formatAmount $vout.Value}} {{$cs}}</span>
</td> </td>
</tr> </tr>
{{end}} {{end}}