From cd6ebb407e79c4129d8759ed3fd9133cf729b5fe Mon Sep 17 00:00:00 2001 From: Christoph Heer Date: Sun, 10 Mar 2013 21:54:11 +0100 Subject: [PATCH] Add check hover pie --- .../static/lib/kirchenreich/dashboard.js | 38 +++++++++++++++- krprj/worshipmap/templates/dashboard.html | 45 ++++++++++++++----- 2 files changed, 72 insertions(+), 11 deletions(-) diff --git a/krprj/worshipmap/static/lib/kirchenreich/dashboard.js b/krprj/worshipmap/static/lib/kirchenreich/dashboard.js index c83be1a..b6bdc0b 100644 --- a/krprj/worshipmap/static/lib/kirchenreich/dashboard.js +++ b/krprj/worshipmap/static/lib/kirchenreich/dashboard.js @@ -1,4 +1,14 @@ -var kr = {}; +if (kr === undefined) { + var kr = {}; +} + +kr.colors = { + yellow: '#ffc40d', + blue: '#049cdb', + red: '#9d261d', + green: '#46a546' +}; + kr.plot = {}; kr.plot.pie = function(target, data) { $.plot($(target), data, { @@ -23,3 +33,29 @@ kr.plot.pie = function(target, data) { } }); }; + +kr.plot.onCheckHover = function(event, check){ + var _data; + if (check === undefined) { + _data = $(this).data(); + } else { + _data = $(check).data(); + } + + var data = [{ + label: 'Reached', + data: _data.reached, + color: kr.colors.green + }, { + label: 'Pending', + data: _data.pending, + color: kr.colors.red + }]; + kr.plot.pie('#check_plot', data); +}; + +$(document).ready(function() { + $("tr.kr_check").hover(kr.plot.onCheckHover); + kr.plot.onCheckHover({}, $("tr.kr_check").first()); +}); + diff --git a/krprj/worshipmap/templates/dashboard.html b/krprj/worshipmap/templates/dashboard.html index e705db1..296f7ff 100644 --- a/krprj/worshipmap/templates/dashboard.html +++ b/krprj/worshipmap/templates/dashboard.html @@ -20,22 +20,22 @@ var krunite_ratio = [{ label: 'OpenStreetMap', data: {{ osm_count }}, - color: '#ffc40d' + color: kr.colors.yellow }, { label: 'Wikipedia', data: {{ wikipedia_count }}, - color: '#049cdb' + color: kr.colors.blue }]; - kr.plot.pie('#pie1', krunite_ratio); + kr.plot.pie('#kirchenreich_plot', krunite_ratio); var osm_ratio = [{ label: 'Ways', data: {{ osm_type.W }}, - color: '#ffc40d' + color: kr.colors.yellow }, { label: 'Nodes', data: {{ osm_type.N }}, - color: '#049cdb' + color: kr.colors.blue }] kr.plot.pie('#osm_ratio_plot', osm_ratio); @@ -46,10 +46,14 @@ +
+

Database status

+
+
-

Kirchenreich.org

+

Kirchenreich.org

{{ osm_count|intcomma }}

OpenStreetMap places

@@ -66,7 +70,7 @@

Kirchenreich.org

-
+
@@ -76,7 +80,7 @@

Kirchenreich.org

-

OpenStreetMap

+

OpenStreetMap

{{ ref_need_update|intcomma }} / {{ ref_count|intcomma }}

References need update

@@ -92,10 +96,10 @@

OpenStreetMap

-
+
-

Wikipedia

+

Wikipedia

{{ wikipedia_count|intcomma }}

Wikipedia articles

@@ -107,5 +111,26 @@

Wikipedia

+
+

Quality checks

+
+
+
+
+ + + {% for check in checks %} + + + + + {% endfor %} + +
{{ check.description }}{{ check.percent_reached}}% ({{ check.reached|intcomma }})
+
+
+
+
+
{% endblock %}