From d612cbeda27a18e4b3572f8e0635a5e6dc3de99c Mon Sep 17 00:00:00 2001 From: sepro Date: Wed, 6 Dec 2017 16:42:19 +0100 Subject: [PATCH] added toggle zoom/pan to profile page --- conekt/templates/expression_profile.html | 18 +++++--- conekt/templates/macros/chartjs.html | 55 +----------------------- 2 files changed, 13 insertions(+), 60 deletions(-) diff --git a/conekt/templates/expression_profile.html b/conekt/templates/expression_profile.html index 81463cb..a4f029a 100644 --- a/conekt/templates/expression_profile.html +++ b/conekt/templates/expression_profile.html @@ -60,9 +60,12 @@

Expression profile for: {{ profile.probe }}

All conditions

-
- +
+
+
+ +

@@ -79,9 +82,12 @@

{{t.name}}

{% endif %}

Note: SPM calculations for this profile are done using the maximum value.

-
- +
+
+
+ +

@@ -102,9 +108,9 @@

{{t.name}}

{% endblock %} \ No newline at end of file diff --git a/conekt/templates/macros/chartjs.html b/conekt/templates/macros/chartjs.html index 268d421..921dd69 100644 --- a/conekt/templates/macros/chartjs.html +++ b/conekt/templates/macros/chartjs.html @@ -92,7 +92,7 @@ }); {%- endmacro %} -{% macro expression_profile_loader(target, url, loader_id, enable_zoom=none, enable_pan=none) -%} +{% macro expression_profile_loader(target, url, loader_id) -%} $( document ).ready(function() { $("#{{ loader_id }}").html(get_loader_svg('{{loader_id}}_leafy')); init_planet_loader('{{loader_id}}_leafy'); @@ -134,59 +134,6 @@ var myChart = new Chart(ctx, data); $("#{{ target }}").toggle(); $("#{{ loader_id }}").toggle(); - - - {% if enable_zoom %} - if (myChart.options.zoom.enabled) { - $("#{{ enable_zoom }}").addClass("btn-success"); - $("#{{ enable_zoom }}").removeClass("btn-danger"); - $("#{{ enable_zoom }}").removeClass("btn-default"); - } else { - $("#{{ enable_zoom }}").addClass("btn-danger"); - $("#{{ enable_zoom }}").removeClass("btn-success"); - $("#{{ enable_zoom }}").removeClass("btn-default"); - } - $("#{{ enable_zoom }}").click( function(ev) { - ev.preventDefault(); - - myChart.options.zoom.enabled = ! myChart.options.zoom.enabled; - if (myChart.options.zoom.enabled) { - $(this).addClass("btn-success"); - $(this).removeClass("btn-danger"); - $(this).removeClass("btn-default"); - } else { - $(this).addClass("btn-danger"); - $(this).removeClass("btn-success"); - $(this).removeClass("btn-default"); - } - }); - {% endif%} - {% if enable_pan %} - if (myChart.options.pan.enabled) { - $("#{{ enable_pan }}").addClass("btn-success"); - $("#{{ enable_pan }}").removeClass("btn-danger"); - $("#{{ enable_pan }}").removeClass("btn-default"); - } else { - $("#{{ enable_pan }}").addClass("btn-danger"); - $("#{{ enable_pan }}").removeClass("btn-success"); - $("#{{ enable_pan }}").removeClass("btn-default"); - } - $("#{{ enable_pan }}").click( function(ev) { - ev.preventDefault(); - - myChart.options.pan.enabled = ! myChart.options.pan.enabled; - if (myChart.options.pan.enabled) { - $(this).addClass("btn-success"); - $(this).removeClass("btn-danger"); - $(this).removeClass("btn-default"); - } else { - $(this).addClass("btn-danger"); - $(this).removeClass("btn-success"); - $(this).removeClass("btn-default"); - } - - }); - {% endif%} }); }); {%- endmacro %}