Show consensus in explorer index page

pull/561/head
Martin Boehm 2020-12-13 22:18:37 +01:00
parent d992369426
commit 7dffe2e0f9
2 changed files with 15 additions and 0 deletions

View File

@ -440,6 +440,7 @@ func (s *PublicServer) parseTemplates() []*template.Template {
"setTxToTemplateData": setTxToTemplateData,
"isOwnAddress": isOwnAddress,
"isOwnAddresses": isOwnAddresses,
"toJSON": toJSON,
}
var createTemplate func(filenames ...string) *template.Template
if s.debug {
@ -507,6 +508,14 @@ func formatTime(t time.Time) string {
return t.Format(time.RFC1123)
}
func toJSON(data interface{}) string {
json, err := json.Marshal(data)
if err != nil {
return ""
}
return string(json)
}
// for now return the string as it is
// in future could be used to do coin specific formatting
func (s *PublicServer) formatAmount(a *api.Amount) string {

View File

@ -100,6 +100,12 @@
<td class="data">{{$be.SizeOnDisk}}</td>
</tr>
{{- end -}}
{{- if $be.Consensus -}}
<tr>
<td>Consensus</td>
<td class="data">{{toJSON $be.Consensus}}</td>
</tr>
{{- end -}}
{{- if $be.Warnings -}}
<tr>
<td>Warnings</td>