diff options
Diffstat (limited to 'templates/base')
-rw-r--r-- | templates/base/footer.tmpl | 22 | ||||
-rw-r--r-- | templates/base/head.tmpl | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl index 0dd8871525..1734d32600 100644 --- a/templates/base/footer.tmpl +++ b/templates/base/footer.tmpl @@ -49,6 +49,28 @@ <script src="https://www.google.com/recaptcha/api.js" async></script> {{end}} {{end}} +{{if .EnableHeatmap}} + <script src="{{AppSubUrl}}/vendor/plugins/moment/moment.min.js" charset="utf-8"></script> + <script src="{{AppSubUrl}}/vendor/plugins/d3/d3.v4.min.js" charset="utf-8"></script> + <script src="{{AppSubUrl}}/vendor/plugins/calendar-heatmap/calendar-heatmap.js" charset="utf-8"></script> + <script type="text/javascript"> + $.get( '{{AppSubUrl}}/api/v1/users/{{.HeatmapUser}}/heatmap', function( chartRawData ) { + var chartData = []; + for (var i = 0; i < chartRawData.length; i++) { + chartData[i] = {date: new Date(chartRawData[i].timestamp * 1000), count: chartRawData[i].contributions}; + } + + $('#loading-heatmap').removeClass('active'); + + var heatmap = calendarHeatmap() + .data(chartData) + .selector('#user-heatmap') + .colorRange(['#f4f4f4', '#459928']) + .tooltipEnabled(true); + heatmap(); + }); + </script> +{{end}} {{if .RequireTribute}} <script src="{{AppSubUrl}}/vendor/plugins/tribute/tribute.min.js"></script> diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl index b6ab8141e2..130ab53755 100644 --- a/templates/base/head.tmpl +++ b/templates/base/head.tmpl @@ -101,6 +101,9 @@ {{if .RequireDropzone}} <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/dropzone/dropzone.css"> {{end}} +{{if .EnableHeatmap}} + <link rel="stylesheet" href="{{AppSubUrl}}/vendor/plugins/calendar-heatmap/calendar-heatmap.css"> +{{end}} <style class="list-search-style"></style> <script src="{{AppSubUrl}}/vendor/plugins/cssrelpreload/loadCSS.min.js"></script> |