Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #606 from TakwimuAfrica/fix/static_path_js-167486021
Browse files Browse the repository at this point in the history
Fix static path reference in JavaScript files
  • Loading branch information
kilemensi authored Jul 24, 2019
2 parents 55e722a + 417a191 commit 3a86193
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions takwimu/static/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ function Chart(options) {
.attr("ga-event-label", window.takwimu.country.slug + '-' + chart.id)
.on("click", chart.share);
chart.share.append('img')
.attr('src', '/static/img/network-connection.svg');
.attr('src', (STATIC_PREFIX || '/static/') + 'img/network-connection.svg');
chart.share.append('p')
.text("Share");

Expand All @@ -1078,7 +1078,7 @@ function Chart(options) {
.attr("ga-event-label", window.takwimu.country.slug + '-' + chart.id)
.on("click", chart.download);
chart.actionDownload.append('img')
.attr('src', '/static/img/download.svg');
.attr('src', (STATIC_PREFIX || '/static/') + 'img/download.svg');
chart.actionDownload.append('p')
.text("Download");

Expand All @@ -1090,7 +1090,7 @@ function Chart(options) {
.attr("ga-event-label", window.takwimu.country.slug + '-' + chart.id)
.on("click", chart.showEmbedCode);
chart.showEmbed.append('img')
.attr('src', '/static/img/code.svg');
.attr('src', (STATIC_PREFIX || '/static/') + 'img/code.svg');
chart.showEmbed.append('p')
.text("Embed");

Expand All @@ -1102,7 +1102,7 @@ function Chart(options) {
.attr("ga-event-label", window.takwimu.country.slug + '-' + chart.id)
.attr("href", chart.distributionURL);
chart.compare.append('img')
.attr('src', '/static/img/compare.svg');
.attr('src', (STATIC_PREFIX || '/static/') + 'img/compare.svg');
chart.compare.append('p')
.text("Compare");

Expand All @@ -1114,7 +1114,7 @@ function Chart(options) {
.attr("ga-event-label", window.takwimu.country.slug + '-' + chart.id)
.on("click", chart.toggleDataDrawer);
chart.showData.append('img')
.attr('src', '/static/img/tablet-reader-31.svg');
.attr('src', (STATIC_PREFIX || '/static/') + 'img/tablet-reader-31.svg');
chart.showData.append('p')
.text("Show Data");
};
Expand Down Expand Up @@ -1162,7 +1162,7 @@ function Chart(options) {
'"></iframe>',
'\n<script src="' +
EMBED_URL +
'/static/js/embed.chart.make.js"></script>'
(STATIC_PREFIX || '/static/') + 'js/embed.chart.make.js"></script>'
].join("");

textarea.html(embedCode);
Expand Down
8 changes: 8 additions & 0 deletions takwimu/templates/settings_js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% extends 'settings_js.html' %}
{% load static %}

{% block settings_javascript %}
{{ block.super }}

var STATIC_PREFIX = '{% get_static_prefix %}';
{% endblock settings_javascript %}

0 comments on commit 3a86193

Please sign in to comment.