-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
142 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{% assign sorted_brands = site.data.clothing_items_brands | sort: 'name' %} | ||
<div class="brand-widget"> | ||
<button type="button" class="all-brands-toggle-button">Select None</button> | ||
<div class="brand-checkboxes-wrap"> | ||
{% for brand in sorted_brands %} | ||
<div> | ||
<label> | ||
<input type="checkbox" name="brand" value="{{ brand.name }}" checked> | ||
<span class="filter-label">{{ brand.name }}</span> | ||
</label> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
|
||
<script> | ||
function toggleBrandSelector(forceSelectAll = false) { | ||
const datasetCheckboxes = brandWidget.querySelectorAll('input[name="brand"]'); | ||
let allChecked; | ||
if (forceSelectAll) { | ||
allChecked = false; | ||
} else { | ||
allChecked = Array.from(datasetCheckboxes).every(checkbox => checkbox.checked); | ||
} | ||
datasetCheckboxes.forEach(checkbox => checkbox.checked = !allChecked); | ||
document.getElementById('select-all-datasets').textContent = allChecked ? 'Select All' : 'Select None'; | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", function() { | ||
document.getElementById('all-brands-toggle-button').addEventListener('click', function () { | ||
toggleBrandSelector(); | ||
}); | ||
} | ||
); | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,50 @@ | ||
{% assign all_color_families = site.data.clothing_items_colors | map: "family" | uniq %} | ||
|
||
{% assign color = include.color %} | ||
<div class="color-widget"> | ||
{% for color_family in all_color_families %} | ||
{% include color_selector_family.html family=color_family %} | ||
{% endfor %} | ||
</div> | ||
|
||
<div class="color-selector selected" data-color="{{ color.name }}" data-family="{{ color.family }}" style="background-color: #{{ color.HTML_code }};" onclick="toggleColorSelector(this)"> | ||
<div class='color-selector-inner-wrap'> | ||
<span class="color-selector-checkmark">✓</span> | ||
</div> | ||
</div> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const familyCheckboxes = document.querySelectorAll(".color-family-checkbox"); | ||
|
||
function toggleFamilySelection(familyCheckbox) { | ||
const familyName = familyCheckbox.dataset.family; | ||
const colorSelectors = document.querySelectorAll(`.color-family-colors-wrap .color-selector[data-family="${familyName}"]`); | ||
|
||
colorSelectors.forEach(selector => { | ||
if (familyCheckbox.checked) { | ||
selector.classList.add("selected"); | ||
} else { | ||
selector.classList.remove("selected"); | ||
} | ||
}); | ||
} | ||
|
||
familyCheckboxes.forEach(familyCheckbox => { | ||
familyCheckbox.addEventListener("change", function () { | ||
toggleFamilySelection(familyCheckbox); | ||
}); | ||
}); | ||
|
||
function toggleColorSelector(colorSelector) { | ||
const familyName = colorSelector.dataset.family; | ||
const familyCheckbox = document.querySelector(`.color-family-checkbox[data-family="${familyName}"]`); | ||
|
||
colorSelector.classList.toggle("selected"); | ||
|
||
if (colorSelector.classList.contains("selected") && !familyCheckbox.checked) { | ||
familyCheckbox.checked = true; | ||
} | ||
} | ||
|
||
const colorSelectors = document.querySelectorAll(".color-selector"); | ||
colorSelectors.forEach(colorSelector => { | ||
colorSelector.addEventListener("click", function() { | ||
toggleColorSelector(colorSelector); | ||
}); | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% assign color_family = include.family %} | ||
{% assign colors = site.data.clothing_items_colors | where: "family", color_family %} | ||
|
||
<div class="color-family-selector"> | ||
<div class="color-family-selector-wrap"> | ||
<!-- Family Checkbox --> | ||
<div class="color-family-checkbox-wrap"> | ||
<input type="checkbox" class="color-family-checkbox" data-family="{{ color_family }}" checked> | ||
</div> | ||
|
||
<!-- Individual Color Checkboxes --> | ||
<div class="color-family-colors-wrap"> | ||
{% for color in colors %} | ||
{% include color_selector_individual.html color=color%} | ||
{% endfor %} | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
{% assign color = include.color %} | ||
|
||
<div class="color-selector selected" data-color="{{ color.name }}" data-family="{{ color.family }}" style="background-color: #{{ color.HTML_code }};"> | ||
<div class='color-selector-inner-wrap'> | ||
<span class="color-selector-checkmark">✓</span> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters