2020-11-08 16:00:33 +00:00
|
|
|
{{define "header"}}
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<link rel="stylesheet" type="text/css" href="../css/main.css">
|
|
|
|
<!-- below line adds jQuery to the page -->
|
|
|
|
<!-- <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> -->
|
|
|
|
<script type='text/javascript' src="https://go-echarts.github.io/go-echarts-assets/assets/echarts.min.js"></script>
|
|
|
|
<title>goCake - {{.Title}}</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
{{template "nav" .}}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "nav"}}
|
|
|
|
<!-- iOS fix -->
|
|
|
|
<meta name='viewport' content='initial-scale=1, viewport-fit=cover, width=device-width'>
|
|
|
|
<nav>
|
|
|
|
<ul>
|
|
|
|
{{ if .Title}}
|
|
|
|
<!-- set current tab active, according to title -->
|
2020-11-08 16:09:58 +00:00
|
|
|
<!-- <li><a {{ if (eq .Title "Home") }}class="active"{{end}} href="/">Home</a></li> -->
|
2020-11-08 16:00:33 +00:00
|
|
|
<!-- <li><a {{ if (eq .Title "Rewards") }}class="active"{{end}} href="rewards">Monthly Rewards</a></li> -->
|
|
|
|
<!-- <li><a {{ if (eq .Title "Graphs") }}class="active"{{end}} href="graphs">Graphs</a></li> -->
|
|
|
|
<li><a {{ if (eq .Title "Monthly Rewards") }}class="active"{{end}} href="rewards">Monthly Rewards</a></li>
|
|
|
|
{{ end }}
|
|
|
|
</ul>
|
|
|
|
</nav>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "footer"}}
|
|
|
|
<div class="footer">♥ 2020 Nils Jakobi
|
|
|
|
- <a href="https://git.nils.zone/nils/goCake">Source Code</a>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "barGraph"}}
|
|
|
|
<div class="container">
|
|
|
|
<div class="item" id="chart"></div>
|
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
|
|
"use strict";
|
|
|
|
var rewardChart = echarts.init(document.getElementById('chart'), "white");
|
|
|
|
var rewardOptions = {
|
|
|
|
title: {"text":"Monthly Rewards","subtext":"{{.Currency}}"},
|
|
|
|
tooltip: {"show":true},
|
|
|
|
legend: {"show":false},
|
|
|
|
dataZoom:[{"type":"inside"}],
|
|
|
|
xAxis: {{ template "xAxis" . }}
|
|
|
|
yAxis: [{}],
|
|
|
|
series: [{{template "series" . }}],
|
|
|
|
color: ["{{.Color}}"],
|
|
|
|
};
|
|
|
|
rewardChart.setOption(rewardOptions);
|
|
|
|
</script>
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{define "xAxis"}}
|
|
|
|
[{"data":[ {{ range $month, $amount := .Rewards}}"{{ $month }}",{{ end }}]}],
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
{{define "series"}}
|
|
|
|
{"name":"{{.Currency}}","type":"bar","waveAnimation":false,"data":[
|
|
|
|
{{ range $month, $amount := .Rewards}}{"value": "{{ $amount }}" },{{ end }}
|
|
|
|
]},
|
|
|
|
{{end}}
|