-
-
Notifications
You must be signed in to change notification settings - Fork 777
/
toolkit.html
121 lines (112 loc) · 4.91 KB
/
toolkit.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
---
layout: default
title: Toolkit
permalink: /toolkit/
---
<!-- Header banner -->
<div class="header-container flex-container">
<div class="header-text">
<h1 class="title1">Our Toolkit</h1>
<p>Toolkit implies that there is one set of tools that is perfect for the job you are tackling!
What you will find here are tools we have found to be effective. Think of this as the most awesome collective tool shed!
Here you can find, share, and suggest tools that are of use to the open source civic tech software community.</p>
</div>
<img class="header-hero-image" src="/assets/images/toolkit/toolkit-hero.svg" alt="" />
</div>
<div class="toolkit-header__text-group">
{% assign category_list = "All, Development, Design, Project Management, Professional Development" | split: ", " %}
{% for category in category_list %}
{% if category == "All" %}
<a href="#{{category | replace: ' ', '+'}}" class="toolkit-header__banner-item selected-category">{{category}}</a>
{% else %}
<a href="#{{category | replace: ' ', '+'}}" class="toolkit-header__banner-item">{{ category }}</a>
{% endif %}
{% endfor %}
</div>
<div class="toolkit-background content-section">
<div class="toolkit__card-list">
<div class="toolkit-flex-container">
<div class="suggest-guide-group">
<h2>Guides</h2>
<button class="btn btn-primary btn-md-narrow">Suggest a guide</button>
</div>
<!-- Iterating through toolkitPages collection -->
{%- assign guides = site.guide-pages | sort: "title" -%}
{%- for item in guides -%}
{%- if item.display == true -%}
{%- include guide-card.html guide=item -%}
{%- endif -%}
{%- endfor -%}
</div>
</div>
<script>
//add listener for click in banner, and toggle classes for filters.
document.querySelectorAll(".toolkit-header__banner-item").forEach(filter => {
filter.addEventListener('click', function(event) {
let thisCategory = event.currentTarget;
let otherCategories = event.currentTarget.parentElement.children;
if (thisCategory.classList.contains('selected-category')) {
return;
} else {
Array.from(otherCategories).forEach((category) => {
if (category.classList.contains('selected-category')) {
category.classList.remove('selected-category');
return; }
});
thisCategory.classList.toggle('selected-category');
}
});
});
//add listener for url change and toggle visible cards.
window.addEventListener("hashchange", hashFilter);
function hashFilter(e) {
let currentHash = location.hash.split('#')[1].replace("+", "").toLowerCase();
let cardContainers = document.querySelectorAll("[data-article-type]");
cardContainers.forEach((card) => {
if(currentHash == 'all'){
card.style.display = 'block';
return;
}
card.dataset.articleType == currentHash ? card.style.display = "block" : card.style.display = "none";
});
}
</script>
<div class="toolkit__card-list">
<div class="toolkit-flex-container">
<div class="suggest-guide-group">
<h2 class="external-resources-text">External Resources</h2>
<button class="btn btn-primary btn-md-narrow">Suggest a resource</button>
</div>
<!-- Searching through toolkitResources collection -->
<div class="external-resource-container">
{%- for item in site.data.internal.toolkitresources -%}
{%- if item.display == true -%}
<div class="toolkit-flex-item section-container">
{%- if item.svg -%}
<div class="toolkit-flex-item-img-container resource-svg-icons">
{% include {{ item.svg }} %}
</div>
{%- endif -%}
<div class="toolkit-info-container">
<h3><a href="{{item.provider-link}}" target="_blank">{{ item.title }}</a></h3>
<p>{{ item.description }}</p>
</div>
<a href="{{item.provider-link}}" class="toolkit-flex-item-status" target="_blank">
{% include {{ item.link-svg }} %}
</a>
</div>
{%- endif -%}
{%- endfor -%}
</div>
</div>
</div>
</div>
<script>
// Add margin to the bottom of cards with status text
let statusElements = document.getElementsByClassName("toolkit-flex-item-status");
for(let i = 0; i < statusElements.length; i++){
let parent = statusElements[i].parentElement;
let infoContainer = parent.getElementsByClassName("toolkit-info-container");
infoContainer[0].style["margin-bottom"] = "3.5rem";
}
</script>