Extract amount template
This commit is contained in:
parent
4a0759af8f
commit
6f4bff929e
@ -29,9 +29,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href="transaction/{{.ID}}">{{.Memo}}</a>
|
<a href="transaction/{{.ID}}">{{.Memo}}</a>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: right;{{if .Amount.GetPositive}}{{else}}color: red;{{end}}">
|
{{template "amount-cell" .Amount}}
|
||||||
{{printf "%.2f" .Amount.GetFloat64}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
11
web/amount.tpl
Normal file
11
web/amount.tpl
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{{define "amount"}}
|
||||||
|
<span class="right {{if .GetPositive}}{{else}}negative{{end}}">
|
||||||
|
{{printf "%.2f" .GetFloat64}}
|
||||||
|
</span>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
{{define "amount-cell"}}
|
||||||
|
<td class="right {{if .GetPositive}}{{else}}negative{{end}}">
|
||||||
|
{{printf "%.2f" .GetFloat64}}
|
||||||
|
</td>
|
||||||
|
{{end}}
|
@ -9,7 +9,7 @@
|
|||||||
{{range .Accounts}}
|
{{range .Accounts}}
|
||||||
<li>
|
<li>
|
||||||
<a href="/budget/{{$.Budget.ID}}/account/{{.ID}}">{{.Name}}</a>
|
<a href="/budget/{{$.Budget.ID}}/account/{{.ID}}">{{.Name}}</a>
|
||||||
<span class="right">{{printf "%.2f" .Balance.GetFloat64}}</span>
|
{{template "amount" .Balance}}
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
<li>
|
<li>
|
||||||
|
@ -24,9 +24,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href="transaction/{{.ID}}">{{.Memo}}</a>
|
<a href="transaction/{{.ID}}">{{.Memo}}</a>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: right;{{if .Amount.GetPositive}}{{else}}color: red;{{end}}">
|
{{template "amount-cell" .Amount}}
|
||||||
{{printf "%.2f" .Amount.GetFloat64}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
@ -28,12 +28,8 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
</td>
|
</td>
|
||||||
<td style="text-align: right;{{if .Balance.GetPositive}}{{else}}color: red;{{end}}">
|
{{template "amount-cell" .Balance}}
|
||||||
{{printf "%.2f" .Balance.GetFloat64}}
|
{{template "amount-cell" .Activity}}
|
||||||
</td>
|
|
||||||
<td style="text-align: right;{{if .Activity.GetPositive}}{{else}}color: red;{{end}}">
|
|
||||||
{{printf "%.2f" .Activity.GetFloat64}}
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</table>
|
</table>
|
||||||
|
@ -60,3 +60,7 @@ body {
|
|||||||
.right {
|
.right {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.negative {
|
||||||
|
color: #d50000;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user