Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: topic/subtopic taxonomy #12

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 27 additions & 42 deletions assets/scripts/filter.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,43 @@
function signpostFilter(topicsByRegion) {
function signpostFilter() {
const form = document.querySelector("form");
const regionInput = document.getElementById("region");
const topicInput = document.getElementById("topic");
const sections = document.querySelectorAll("section[data-regions]");
const accordionItems = document.querySelectorAll("details");
const article = document.getElementById("signposts-by-region");
const sections = article.querySelectorAll("section[data-regions]");

const updateVisibility = (element, isVisible) =>
element.toggleAttribute("hidden", !isVisible);
const normalise = (value) =>
value ? value.toLowerCase().replace(/ /g, "-") : "";

const hideAll = (isFormPresent) => {
if (!isFormPresent) {
return;
}
sections.forEach((section) => updateVisibility(section, false));
accordionItems.forEach((item) => updateVisibility(item, false));
};

const filterSectionsAndAccordionItems = (selectedRegion, selectedTopic) => {
sections.forEach((section) => {
const sectionRegions = section.dataset.regions
.split(" | ")
.map((region) => region.toLowerCase().replace(/ /g, "-"));
const filter = () => {
const selectedRegion = normalise(regionInput.value);
const selectedTopic = normalise(topicInput.value);

const isVisible = sectionRegions.includes(selectedRegion);
updateVisibility(section, isVisible);
// all the topic lists are already in the html
topicInput.setAttribute("list", selectedRegion);

if (isVisible) {
const items = section.querySelectorAll("details");
items.forEach((item) => {
const itemTopics = item.dataset.topics.split(" | ");
const itemVisible = itemTopics.includes(selectedTopic);
updateVisibility(item, itemVisible);
sections.forEach((section) => {
// hide the regions that don't match
const regionMatch = normalise(section.dataset.regions) === selectedRegion;
section.hidden = !regionMatch;
// within, hide the entries that don't match the topic
// we've limited the top level topic to 1 in config.yml
if (regionMatch) {
section.querySelectorAll("details").forEach((detail) => {
detail.hidden =
selectedTopic && normalise(detail.dataset.topics) !== selectedTopic;
});
}
});
};

const handleSubmit = (event) => {
event.preventDefault();

const selectedRegion = regionInput.value.toLowerCase().replace(/ /g, "-");
const selectedTopic = topicInput.value;

filterSectionsAndAccordionItems(selectedRegion, selectedTopic);
};

const handleRegionChange = () => {
const selectedRegion = regionInput.value.toLowerCase().replace(" ", "-");
topicInput.setAttribute("list", `${selectedRegion}`);
};
sections.forEach((section) => (section.hidden = true));

hideAll(form);
regionInput.addEventListener("input", handleRegionChange);
form.addEventListener("submit", handleSubmit);
regionInput.addEventListener("input", filter);
topicInput.addEventListener("input", filter);
form.addEventListener("reset", () => {
sections.forEach((section) => (section.hidden = true));
topicInput.setAttribute("list", " ");
});
}

document.addEventListener("DOMContentLoaded", signpostFilter);
8 changes: 8 additions & 0 deletions assets/theme/labels.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.tag,
.label {
display: inline-block;
padding: 0 var(--theme-spacing--2);
border-radius: var(--theme-spacing--6);
border: 1px solid var(--theme-color--outline-event);
background: var(--theme-color--outline);
}
2 changes: 1 addition & 1 deletion assets/theme/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
margin: 0 auto;

&__main {
padding-top: var(--theme-spacing--6);
padding: var(--theme-spacing--3) 0;
}

&__header,
Expand Down
7 changes: 0 additions & 7 deletions assets/theme/lists.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ li[class] {
list-style: none;
}

ul.topics {
padding-left: var(--theme-spacing--gutter);
li {
list-style-type: "☂️ ";
margin-bottom: 0.5em;
}
}
ul.regions {
padding-left: var(--theme-spacing--gutter);
li {
Expand Down
1 change: 1 addition & 0 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ repo = "https://github.com/CodeYourFuture/CYF-Signposts"
[taxonomies]
series = "regions"
tags = "topics"
subtopics = "subtopics"
5 changes: 4 additions & 1 deletion content/posts/acas.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ title: ACAS
link: https://www.acas.org.uk/
date: 2023-04-14T10:25:40.254Z
description: Advisory, Conciliation and Arbitration Service
topics:
subtopics:
- Legal support
subtopics:
- Workplace Rights
regions:
- Glasgow
- London
- North West
- West Midlands
---

Acas gives employees and employers free, impartial advice on workplace rights, rules and best practice. It also offers training and help to resolve disputes.
3 changes: 3 additions & 0 deletions content/posts/access-needs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ link: https://forms.gle/6mC4Z63yQti8Pwwq8
date: 2024-02-19T20:29:53.538Z
description: Getting help with accessing learning at Code Your Future
topics:
- Support for CYF Class
subtopics:
- Accessibility
- Disability
- Autism
Expand All @@ -15,6 +17,7 @@ regions:
- North West
- West Midlands
---

CYF is a community grassroots organisation and we do not have our own premises, so we cannot guarantee that we can meet every possible need. We prioritise the actual needs of our trainees so please share your access need by completing this form.

We will use this data in the ways described in our [Personal Circumstances Data Policy](https://docs.google.com/document/d/10InrZgoyQye0lwa6okL1px8HBnm3CeD32yyZCJOnECA/edit?usp=sharing)
Expand Down
9 changes: 6 additions & 3 deletions content/posts/access-to-work.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ link: https://www.gov.uk/access-to-work
date: 2024-02-22T10:21:00.633Z
description: Find out more about the Access to Work Scheme
topics:
- Career support
subtopics:
- Disability
- Accessibility
- Workplace Rights
Expand All @@ -16,12 +18,13 @@ regions:
- North West
- West Midlands
---

Access to Work can help you get or stay in work if you have a physical or mental health condition or disability.

The support you get will depend on your needs. Through Access to Work, you can apply for:

* a grant to help pay for practical support with your work
* support with managing your mental health at work
* money to pay for communication support at job interviews
- a grant to help pay for practical support with your work
- support with managing your mental health at work
- money to pay for communication support at job interviews

You are not eligible for Access to Work support as a trainee or volunteer at Code Your Future. However, you can apply for Access to Work up to 6 weeks before you start work if you have a job offer.
5 changes: 4 additions & 1 deletion content/posts/accessing-tax-free-childcare.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ link: https://www.gov.uk/get-tax-free-childcare
date: 2023-08-29T14:32:25.973Z
description: Step by step information on Tax-Free Childcare
topics:
- Support for CYF Class
subtopics:
- Childcare
regions:
- Glasgow
- London
- North West
- West Midlands
---
Check if you’re eligible for Tax-Free Childcare, how to apply and how to pay your childcare provider.

Check if you’re eligible for Tax-Free Childcare, how to apply and how to pay your childcare provider.
5 changes: 4 additions & 1 deletion content/posts/accessing-the-internet.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ link: https://docs.codeyourfuture.io/trainees/support/trainee-expenses
date: 2023-08-01T10:50:16.551Z
description: How to access help with internet connectivity through CYF
topics:
- Support for CYF Class
subtopics:
- Equipment
regions:
- Glasgow
- London
- North West
- West Midlands
---

CodeYourFuture can help you in accessing the internet if you are a CYF trainee.

We can reimburse for your costs or in some circumstances provide a data sim.
We can reimburse for your costs or in some circumstances provide a data sim.
5 changes: 4 additions & 1 deletion content/posts/andys-man-club.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ link: https://andysmanclub.co.uk/
date: 2024-10-10T13:36:00.000Z
description: A men’s suicide prevention charity,
topics:
- Mental Health
subtopics:
- Suicide
- Mental Health Crisis
regions:
Expand All @@ -12,4 +14,5 @@ regions:
- North West
- West Midlands
---
Suicide prevention support. Free-to-attend peer-to-peer support groups across the United Kingdom and online. For men only.

Suicide prevention support. Free-to-attend peer-to-peer support groups across the United Kingdom and online. For men only.
3 changes: 2 additions & 1 deletion content/posts/birmingham-homelessness-team.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ topics:
regions:
- West Midlands
---

Homelessness services in Birmingham are available 24/7 over the telephone.

**Monday to Friday, 10am to 5pm:** **0121 303 7410**. Select option 3

All other times: 0121 303 2296
All other times: 0121 303 2296
3 changes: 3 additions & 0 deletions content/posts/boaz-trust.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ date: 2023-09-15T10:41:21.022Z
description: Homelessness support for refugees and asylum seekers in Manchester
topics:
- Homelessness
subtopics:
- Homelessness
- Destitution
- Refused Asylum
regions:
- North West
---

1. We offer safe accommodation and holistic support to people who have been made homeless and destitute through the asylum process.

2. Boaz Floating Support provides holistic support including ensuring people have access to legal advice, practical help to relieve destitution, and other specialist support, advice and signposting (in partnership with the Booth Centre and GMIAU as part of the Greater Manchester Restricted Eligibility Support Service).
6 changes: 4 additions & 2 deletions content/posts/caras.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ title: CARAS
link: https://caras.org.uk/what-we-do/adult-services/#social-and-wellbeing
date: 2024-07-01T18:36:00.000Z
description: ESOL teaching and conversation for refugees and asylum seekers

topics:
- English
regions:
- London
---

ESOL English language support, community centre, coffee, theatre trips etc

1. Anyone who is in the asylum system

2. Anyone who has been granted refugee status

3. People who are joining their family members on refugee family reunion visas
3. People who are joining their family members on refugee family reunion visas

4. Refused asylum seekers and ARE cases

*And*
_And_

live in South London.

Expand Down
3 changes: 3 additions & 0 deletions content/posts/childcare-choices.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ link: https://www.childcarechoices.gov.uk/
date: 2024-07-02T18:11:00.000Z
description: Enter your details to help find out how you can save money on your childcare.
topics:
- Support for CYF Class
subtopics:
- Childcare
regions:
- Glasgow
- London
- North West
- West Midlands
---

**Help paying for your childcare**

Government help with childcare costs for parents. Whether you have toddlers or teens, you could get support. You can get this help if you are in work or unemployed.
5 changes: 4 additions & 1 deletion content/posts/citizen-advice-for-scotland.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ link: https://www.citizensadvice.org.uk/scotland/
date: 2023-04-27T12:14:13.238Z
description: Benefits, Your Rights, and the Law
topics:
- Legal support
subtopics:
- Legal Advice
- Benefits
regions:
- Glasgow
---
Good quality, free, independent legal advice. You do not have to be a British Citizen to access Citizen's Advice.

Good quality, free, independent legal advice. You do not have to be a British Citizen to access Citizen's Advice.
5 changes: 4 additions & 1 deletion content/posts/citizens-advice.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ link: https://www.citizensadvice.org.uk/
date: 2023-05-24T07:39:13.449Z
description: Benefits, Your Rights, and the Law
topics:
- Legal support
subtopics:
- Legal Advice
- Benefits
regions:
- London
- North West
- West Midlands
---
Good quality, free, independent legal advice. You do **not have to be a British Citizen** to access Citizen's Advice.

Good quality, free, independent legal advice. You do **not have to be a British Citizen** to access Citizen's Advice.
3 changes: 3 additions & 0 deletions content/posts/claiming-childcare-expenses.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ link: https://docs.google.com/document/d/1UuPLflvuSED3XczbzGzgj2utwzXbWP-fxKMkqL
date: 2023-08-01T10:35:32.033Z
description: How to claim expenses for childcare through CYF
topics:
- Support for CYF Class
subtopics:
- Childcare
regions:
- Glasgow
- London
- North West
- West Midlands
---

CodeYourFuture can help trainees who have support needs.

Funding towards childcare is one of the ways we can help. Our trainee expenses policy gives more details.
3 changes: 3 additions & 0 deletions content/posts/community-computers-shop.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ link: https://shop.communitycomputers.co.uk/
date: 2024-10-24T10:22:00.000Z
description: £60 laptops £15 phones
topics:
- Poverty
subtopics:
- Equipment
regions:
- North West
---

Refurbished, warranty-covered computers, laptops, phones, and tablets for Manchester residents on a low income. (Documentation is required.)
3 changes: 3 additions & 0 deletions content/posts/concessionary-rail-passes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ link: https://www.nationalrail.co.uk/railcards/
date: 2024-06-27T09:27:00.000Z
description: Schemes that offer discounted or free rail passes
topics:
- Poverty
subtopics:
- Transport
regions:
- Glasgow
- London
- North West
- West Midlands
---

In particular:\
\
**Jobcentre Plus Travel Discount Card**
Expand Down
Loading