From 1fcc205b1038bf14f421f9c5528c20419b25430c Mon Sep 17 00:00:00 2001
From: Fredrik Jonsson <frjo@xdeb.org>
Date: Thu, 28 Mar 2019 09:31:55 +0100
Subject: [PATCH] Hack to add dataviz iframe to a specific standard page via
 javascript.

---
 .../standardpages/information_page.html         |  4 ++++
 .../src/javascript/public/dataviz-iframe.js     | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 opentech/static_src/src/javascript/public/dataviz-iframe.js

diff --git a/opentech/public/standardpages/templates/standardpages/information_page.html b/opentech/public/standardpages/templates/standardpages/information_page.html
index 8a22f0df0..fdd7ebac6 100644
--- a/opentech/public/standardpages/templates/standardpages/information_page.html
+++ b/opentech/public/standardpages/templates/standardpages/information_page.html
@@ -18,3 +18,7 @@
     {% include "includes/relatedcontent.html" with related_pages=page.related_pages.all %}
 
 {% endblock %}
+
+{% block extra_js %}
+    <script src="{% static 'js/public/dataviz-iframe.js' %}"></script>
+{% endblock %}
diff --git a/opentech/static_src/src/javascript/public/dataviz-iframe.js b/opentech/static_src/src/javascript/public/dataviz-iframe.js
new file mode 100644
index 000000000..9838cd915
--- /dev/null
+++ b/opentech/static_src/src/javascript/public/dataviz-iframe.js
@@ -0,0 +1,17 @@
+(function ($) {
+
+    'use strict';
+
+    if (window.location.pathname.indexOf('visualizing-otf-application-data') !== -1) {
+        var $dataviz_iframe = $('<iframe/>', {
+            id: 'dataviz',
+            src: 'https://dataviz.opentech.fund/',
+            title: 'Visualizing OTF Application Data',
+            width: '100%',
+            height: '140rem',
+            frameborder: 0
+        });
+        $('.section--share').before($dataviz_iframe);
+    }
+
+})(jQuery);
-- 
GitLab