forked from timwis/sheetstat
-
Notifications
You must be signed in to change notification settings - Fork 8
/
top-10-cities.html
83 lines (74 loc) · 3.59 KB
/
top-10-cities.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
layout: default
title: Top 10 Cities
permalink: /top-10-cities/
---
<div class="row">
<div class="medium-24 column">
<!-- Loop through Indicators and group by Category -->
{% assign categories = site.data[site.year].top_10_cities | group_by: 'Category' %}
{% assign labels = site.data[site.year].top_10_cities_labels %}
<!-- Dropdown to select category-->
<div class="category-selector small-24 column ptm pbs">
<label for="categories">Choose a category</label>
<select id="categories">
<optgroup label="Categories">
{% for category in categories %}
<option value="{{ category.name | slugify }}">{{ category.name }}</option>
{% endfor %}
</optgroup>
</select>
</div>
<!-- Category Headings -->
{% for category in categories %}
<h1 id="{{ category.name | slugify }}" class="contrast {% if category.name == 'Social determinants of health' %}first-section{% else %}category-section{% endif %}">{{ category.name }}
<a href="#{{ category.name | slugify }}" class="header-link"><i class="fa fa-link"></i></a></h1>
<!-- Indicator Heading (chart title) -->
{% for row in category.items %}
<h2 id="{{ row.Indicator | slugify }}" class="chart-section">{{ row.Indicator | replace: "<", "<" }}
<a href="#{{ row.Indicator | slugify }}" class="header-link"><i class="fa fa-link"></i></a>
</h2>
<!-- Subtitle (if present) -->
{% if row.subTitle %}<p>{{ row.subTitle }}</p>{% endif %}
<div class="row">
<!-- Render charts -->
<div class="medium-16 column">
{% if row.dataType == 'Rate' or row.dataType == 'Count' %}
{% include components/bar-rate.html row=row labels=labels %}{% else %}
{% include components/bar.html row=row labels=labels %}
{% endif %}
</div>
<!-- Sidebar -->
<div class="medium-8 column end">
<aside class="related plm-mu">
<!-- Description of indicator & comments -->
{% if row.description %}<span class="source"><strong>Description: </strong></span><br>
<span class="description">{{ row.description | replace: "<", "<" | markdownify }}</span>{% endif %}
{% if row.chartComment or row.Note %}<span class="source"><strong>Note: </strong></span><br> {% endif %}
{% if row.chartComment %} <p class="source">{{ row.chartComment }}</p>{% endif %}
{% if row.Note %} <p class="source">{{ row.Note }}</p>{% endif %}
<!-- Data source(s) -->
{% if row.dataSource2 %}
<p class="source"><strong>Sources:</strong><br>
{{ row.dataSource | markdownify | remove: '<p>' | remove: '</p>' }} | {{ row.dataSourceYear }},<br>
{{ row.dataSource2 | markdownify | remove: '<p>' | remove: '</p>' }} | {{ row.dataSource2Year }}</p>{% else %}
<span class="source"><strong>Source:</strong><br>
{{ row.dataSource | markdownify | remove: '<p>' | remove: '</p>' }} | {{ row.dataSourceYear }}</span>
{% endif %}
</aside>
</div>
</div>
<!-- End of each chart section with BACK TO TOP link -->
<div class="medium-24 column top">
<a class="float-right" href="#top"><i class="fa fa-arrow-up"></i> <span class="to-top">back to top</span></a>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
<script>
document.getElementById('categories').addEventListener('change', function (evt) {
var value = this.value;
window.location.hash = value;
})
</script>