Templates for DataSnipper and Williams-Sonoma
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
{% capture course_path %}
|
{% capture course_path %}
|
||||||
{% route course, id: course.id %}
|
{% route course, id: course.id %}
|
||||||
{% endcapture %}
|
{% endcapture %}
|
||||||
<div class="np-card course-card">
|
<div class="np-card course-card" categories="{%for category in course.categories%}{{category.name}}[$]{%endfor%}">
|
||||||
<div class="np-card-container">
|
<div class="np-card-container">
|
||||||
<div class="np-progress-bar-container">
|
<div class="np-progress-bar-container">
|
||||||
<div style="width: {{ course.progress }}%" class="np-card-progress-bar"></div>
|
<div style="width: {{ course.progress }}%" class="np-card-progress-bar"></div>
|
||||||
|
|||||||
@ -9,10 +9,12 @@
|
|||||||
<label class="filter">
|
<label class="filter">
|
||||||
{{ category.name }}
|
{{ category.name }}
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
class="filter-checkbox"
|
||||||
name="{{category.name}}"
|
type="checkbox"
|
||||||
|
id="{{category.name}}"
|
||||||
|
name="{{category.name}}"
|
||||||
value="{{category.name}}" />
|
value="{{category.name}}" />
|
||||||
<span class="checkmark"></span>
|
<span class="filter-checkmark"></span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@ -21,7 +23,7 @@
|
|||||||
<div class="filter-group">
|
<div class="filter-group">
|
||||||
<div class="filter-group-heading">What is your learning style?</div>
|
<div class="filter-group-heading">What is your learning style?</div>
|
||||||
<div class="filters"></div>
|
<div class="filters"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="filters-reset np-button" onClick="resetFilters()">Reset all Filters</div>
|
<div class="filters-reset np-button" onClick="resetFilters()">Reset all Filters</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -66,7 +68,7 @@
|
|||||||
width: 0;
|
width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-item .checkmark {
|
.filter-item .filter-checkmark {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 3px;
|
top: 3px;
|
||||||
left: 0;
|
left: 0;
|
||||||
@ -77,17 +79,17 @@
|
|||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-item .checkmark:after {
|
.filter-item .filter-checkmark:after {
|
||||||
content: "";
|
content: "";
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
input:checked ~ .checkmark:after {
|
input:checked ~ .filter-checkmark:after {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter-item .checkmark:after {
|
.filter-item .filter-checkmark:after {
|
||||||
left: 8px;
|
left: 8px;
|
||||||
top: 3px;
|
top: 3px;
|
||||||
width: 5px;
|
width: 5px;
|
||||||
@ -116,18 +118,64 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("DOMContentLoaded", function() {})
|
window.addEventListener("DOMContentLoaded", function() {
|
||||||
|
var categoryCheckboxes = document.querySelectorAll('.filter-checkbox');
|
||||||
|
categoryCheckboxes.forEach(function (checkbox) {
|
||||||
|
checkbox.addEventListener('change', function () {
|
||||||
|
filterCourses();
|
||||||
|
});
|
||||||
|
filterCourses();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
function resetFilters() {
|
function resetFilters() {
|
||||||
console.log("resettting filtes")
|
console.log("resetting filtes")
|
||||||
const allFilters = document.querySelectorAll("input[type='checkbox']")
|
const allFilters = document.querySelectorAll("input[type='checkbox']")
|
||||||
allFilters.forEach(element => {
|
allFilters.forEach(element => {
|
||||||
element.checked = false;
|
element.checked = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const allCourses = document.querySelectorAll('.course-columns');
|
const allCourses = document.querySelectorAll('.course-columns');
|
||||||
|
console.log(allCourses)
|
||||||
allCourses.forEach(element => {
|
allCourses.forEach(element => {
|
||||||
element.style.display = 'flex';
|
element.style.display = 'flex';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterCourses() {
|
||||||
|
var selectedCategories = getSelectedCategories();
|
||||||
|
console.log(selectedCategories)
|
||||||
|
var cards = document.querySelectorAll('.np-card');
|
||||||
|
|
||||||
|
cards.forEach(function (card) {
|
||||||
|
var categories = card.getAttribute('categories');
|
||||||
|
var categoryMatch = selectedCategories.length === 0 || matchesCategories(categories, selectedCategories);
|
||||||
|
|
||||||
|
if (categoryMatch) {
|
||||||
|
card.parentElement.style.display = 'flex';
|
||||||
|
} else {
|
||||||
|
card.parentElement.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getSelectedCategories() {
|
||||||
|
var selectedCategories = [];
|
||||||
|
var checkboxes = document.querySelectorAll('.filter-checkbox:checked');
|
||||||
|
checkboxes.forEach(function (checkbox) {
|
||||||
|
selectedCategories.push(checkbox.id);
|
||||||
|
});
|
||||||
|
return selectedCategories;
|
||||||
|
}
|
||||||
|
|
||||||
|
function matchesCategories(courseCategories, selectedCategories) {
|
||||||
|
var courseCategoriesArray = courseCategories.split('[$]').map(function (category) {
|
||||||
|
return category.trim();
|
||||||
|
});
|
||||||
|
|
||||||
|
return selectedCategories.some(function (selectedCategory) {
|
||||||
|
return courseCategoriesArray.includes(selectedCategory);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
{% for course in courses.in_catalog %}
|
{% for course in courses.in_catalog %}
|
||||||
|
{% comment %} Change to courses.enrolled {%endcomment%}
|
||||||
{% for category in course.categories %}
|
{% for category in course.categories %}
|
||||||
{% if category.name contains "Featured Courses" %}
|
{% if category.name contains "Featured Courses" %}
|
||||||
<div class="np-card" style="width:100%">
|
<div class="np-card" style="width:100%">
|
||||||
|
|||||||
8
Todos.md
8
Todos.md
@ -426,3 +426,11 @@ message](https://northpasshq.slack.com/archives/C04RER4PH09/p1709147957374999?th
|
|||||||
Nextweek deadline
|
Nextweek deadline
|
||||||
|
|
||||||
Run lighthouse on anthology templates and find list of things that need to be improved
|
Run lighthouse on anthology templates and find list of things that need to be improved
|
||||||
|
|
||||||
|
## 10-08-2024
|
||||||
|
- [ ] WSGC - Add logic for [IC] in group name
|
||||||
|
- [ ] WSGC - Change holiday course from catalog to enrolled
|
||||||
|
- [ ] WSGC - Test iFrame (check Gong recordings)
|
||||||
|
- [ ] Luminate - Search results in Canada not working
|
||||||
|
- [ ] Spark - Enable search functionality
|
||||||
|
- [X] DataSnipper - Figure out logic for filters function
|
||||||
|
|||||||
Reference in New Issue
Block a user