Add amounts and translations to plamo filters.
This commit is contained in:
parent
408f30d574
commit
36d6574984
@ -532,6 +532,11 @@ isUpcoming cutoff item = do
|
|||||||
|
|
||||||
langDict :: String -> Context a
|
langDict :: String -> Context a
|
||||||
langDict "nl" =
|
langDict "nl" =
|
||||||
|
constField "filter" "Filter" <>
|
||||||
|
constField "filter-plamo-in-box" "Nog in het doosje" <>
|
||||||
|
constField "filter-plamo-building" "Aan het bouwen" <>
|
||||||
|
constField "filter-plamo-built" "Gebouwd" <>
|
||||||
|
constField "filter-plamo-complete" "Compleet" <>
|
||||||
constField "switcher" "Taal" <>
|
constField "switcher" "Taal" <>
|
||||||
constField "title-japan" "Japan" <>
|
constField "title-japan" "Japan" <>
|
||||||
constField "title-plamo" "Plamo" <>
|
constField "title-plamo" "Plamo" <>
|
||||||
@ -558,6 +563,11 @@ langDict "nl" =
|
|||||||
mempty
|
mempty
|
||||||
|
|
||||||
langDict "jp" =
|
langDict "jp" =
|
||||||
|
constField "filter" "フィルター" <>
|
||||||
|
constField "filter-plamo-in-box" "未開封" <>
|
||||||
|
constField "filter-plamo-building" "製作中" <>
|
||||||
|
constField "filter-plamo-built" "組立完了" <>
|
||||||
|
constField "filter-plamo-complete" "完成" <>
|
||||||
constField "switcher" "言語" <>
|
constField "switcher" "言語" <>
|
||||||
constField "title-japan" "日本" <>
|
constField "title-japan" "日本" <>
|
||||||
constField "title-plamo" "プラモ" <>
|
constField "title-plamo" "プラモ" <>
|
||||||
@ -584,6 +594,11 @@ langDict "jp" =
|
|||||||
mempty
|
mempty
|
||||||
|
|
||||||
langDict "en" =
|
langDict "en" =
|
||||||
|
constField "filter" "Filter" <>
|
||||||
|
constField "filter-plamo-in-box" "Still in box" <>
|
||||||
|
constField "filter-plamo-building" "Building" <>
|
||||||
|
constField "filter-plamo-built" "Built" <>
|
||||||
|
constField "filter-plamo-complete" "Complete" <>
|
||||||
constField "switcher" "Language" <>
|
constField "switcher" "Language" <>
|
||||||
constField "title-japan" "Japan" <>
|
constField "title-japan" "Japan" <>
|
||||||
constField "title-plamo" "Plamo" <>
|
constField "title-plamo" "Plamo" <>
|
||||||
|
|||||||
@ -2,28 +2,23 @@
|
|||||||
|
|
||||||
<div class="filters">
|
<div class="filters">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Filter by status</legend>
|
<legend>$filter$</legend>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" value="Still in box" checked>
|
<input class="me-2" type="checkbox" value="$filter-plamo-in-box$" checked>
|
||||||
Still in box
|
$filter-plamo-in-box$
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" value="Building" checked>
|
<input class="me-2" type="checkbox" value="$filter-plamo-building$" checked>
|
||||||
Building
|
$filter-plamo-building$
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" value="Built" checked>
|
<input class="me-2" type="checkbox" value="$filter-plamo-built$" checked>
|
||||||
Built
|
$filter-plamo-built$
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" value="Complete" checked>
|
<input class="me-2" type="checkbox" value="$filter-plamo-complete$" checked>
|
||||||
Complete
|
$filter-plamo-complete$
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -82,6 +77,26 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
const checkboxes = document.querySelectorAll(".filters input[type=checkbox]");
|
const checkboxes = document.querySelectorAll(".filters input[type=checkbox]");
|
||||||
const kits = document.querySelectorAll(".kit");
|
const kits = document.querySelectorAll(".kit");
|
||||||
|
|
||||||
|
// Count by status.
|
||||||
|
const counts = {};
|
||||||
|
kits.forEach(kit => {
|
||||||
|
const status = kit.dataset.status;
|
||||||
|
counts[status] = (counts[status] || 0) + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update each filter label with the count.
|
||||||
|
document.querySelectorAll(".filters input[type='checkbox']")
|
||||||
|
.forEach(checkbox => {
|
||||||
|
const value = checkbox.value;
|
||||||
|
const count = counts[value] || 0;
|
||||||
|
|
||||||
|
// Update label text
|
||||||
|
const label = checkbox.parentElement;
|
||||||
|
const textNode = label.childNodes[label.childNodes.length - 1];
|
||||||
|
|
||||||
|
textNode.textContent = textNode.textContent.trim() + " (" + count + ")";
|
||||||
|
});
|
||||||
|
|
||||||
function updateFilter() {
|
function updateFilter() {
|
||||||
const selected = Array.from(checkboxes)
|
const selected = Array.from(checkboxes)
|
||||||
.filter(cb => cb.checked)
|
.filter(cb => cb.checked)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user