Skip to content

Commit

Permalink
SHARE: Data should start empty, be within themes folder & not be in repo
Browse files Browse the repository at this point in the history
  • Loading branch information
flavour committed Jul 27, 2018
1 parent e13e36c commit 498b369
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/static/cache/*
/static/fonts/unifont.ttf
/static/scripts/tools/compiler.jar
/static/themes/SHARE/data/*
/tests/unit/*.pdf
.DS_Store
/languages/*.po
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e8f1fb8f7 (2018-07-27 11:46:36)
e13e36c58 (2018-07-27 11:55:48)
9 changes: 5 additions & 4 deletions modules/templates/SHARE/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,19 +601,20 @@ def update_data(cls):
SEPARATORS = (",", ":")

import os
base = os.path.join(current.request.folder, "static", "data", "SHARE")
os_path_join = os.path.join
base = os_path_join(current.request.folder, "static", "themes", "SHARE", "data")

path = os.path.join(base, "needs_by_status.json")
path = os_path_join(base, "needs_by_status.json")
data = cls.needs_by_status()
with open(path, "wb") as outfile:
json.dump(data, outfile, separators=SEPARATORS, encoding="utf-8")

path = os.path.join(base, "needs_by_district.json")
path = os_path_join(base, "needs_by_district.json")
data = cls.needs_by_district()
with open(path, "wb") as outfile:
json.dump(data, outfile, separators=SEPARATORS, encoding="utf-8")

path = os.path.join(base, "people_affected.json")
path = os_path_join(base, "people_affected.json")
data = cls.people_affected()
with open(path, "wb") as outfile:
json.dump(data, outfile, separators=SEPARATORS, encoding="utf-8")
Expand Down
6 changes: 3 additions & 3 deletions modules/templates/SHARE/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ <h1>{{=T("Current Needs & Commitments at a glance")}}</h1>
<div class='row'>
<div class='small-12 medium-4 columns'>
<h6>Needs by Status</h6>
<div class='homepage-chart' data-type='piechart' data-source='/{{=appname}}/static/data/SHARE/needs_by_status.json' data-legend='off'></div>
<div class='homepage-chart' data-type='piechart' data-source='/{{=appname}}/static/themes/SHARE/data/needs_by_status.json' data-legend='off'></div>
</div>
<div class='small-12 medium-4 columns'>
<h6>Needs by District</h6>
<div class='homepage-chart' data-type='multibarchart' data-source='/{{=appname}}/static/data/SHARE/needs_by_district.json' data-controls='off'></div>
<div class='homepage-chart' data-type='multibarchart' data-source='/{{=appname}}/static/themes/SHARE/data/needs_by_district.json' data-controls='off'></div>
</div>
<div class='small-12 medium-4 columns'>
<h6>People Affected</h6>
<h6>(by categories as defined by organisations at data collection)</h6>
<div class='homepage-chart' data-type='barchart' data-source='/{{=appname}}/static/data/SHARE/people_affected.json'></div>
<div class='homepage-chart' data-type='barchart' data-source='/{{=appname}}/static/themes/SHARE/data/people_affected.json'></div>
</div>
</div>
</div>
Expand Down

0 comments on commit 498b369

Please sign in to comment.