summaryrefslogtreecommitdiffstats
path: root/templates/base/footer.tmpl
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2018-11-27 11:36:54 +0200
committerJonas Franz <info@jonasfranz.software>2018-11-27 10:36:54 +0100
commite09fe487734238708c2f9fc7c47dbb2132250400 (patch)
treebd302a98f3badfe9e2b74283e2d068bfd92bb5f8 /templates/base/footer.tmpl
parentc03a9b3e422ded9d8200a83b94ab56ddb4740d94 (diff)
downloadgitea-e09fe487734238708c2f9fc7c47dbb2132250400.tar.gz
gitea-e09fe487734238708c2f9fc7c47dbb2132250400.zip
Refactor heatmap to vue component (#5401)
Diffstat (limited to 'templates/base/footer.tmpl')
-rw-r--r--templates/base/footer.tmpl29
1 files changed, 7 insertions, 22 deletions
diff --git a/templates/base/footer.tmpl b/templates/base/footer.tmpl
index 320b4fa1db..dff23f12f7 100644
--- a/templates/base/footer.tmpl
+++ b/templates/base/footer.tmpl
@@ -49,28 +49,6 @@
<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({{SafeJS HeatmapColorRange}})
- .tooltipEnabled(true);
- heatmap();
- });
- </script>
-{{end}}
{{if .RequireTribute}}
<script src="{{AppSubUrl}}/vendor/plugins/tribute/tribute.min.js"></script>
@@ -136,6 +114,13 @@
<!-- JavaScript -->
<script src="{{AppSubUrl}}/vendor/plugins/semantic/semantic.min.js"></script>
<script src="{{AppSubUrl}}/js/index.js?v={{MD5 AppVer}}"></script>
+{{if .EnableHeatmap}}
+ <script src="{{AppSubUrl}}/vendor/plugins/moment/moment.min.js" charset="utf-8"></script>
+ <script src="{{AppSubUrl}}/vendor/plugins/vue-calendar-heatmap/vue-calendar-heatmap.browser.js" charset="utf-8"></script>
+ <script type="text/javascript">
+ initHeatmap('user-heatmap', '{{.HeatmapUser}}');
+ </script>
+{{end}}
{{template "custom/footer" .}}
</body>
</html>