From 5abd7b1ede27603c0c3fdc9f47d4ff9d67c28ed8 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Wed, 18 Nov 2026 10:06:31 -0700 Subject: [PATCH] Say "35 trails", not "35 of 35 trails", when nothing is filtered out The count above each set of rows keeps the "12 of 35 trails" form only when some are filtered out, in the built pages and in the script alike. Co-Authored-By: Claude Fable 5.2 --- CHANGELOG.md | 4 ++++ web/assets/app.js | 13 ++++++++++--- web/olt/home.py | 2 +- web/tests/test_facets.py | 3 ++- web/tests/test_filter_bar.py | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fc9566..a57a427 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2026-11-18 - The count above a list drops "of" when nothing is left out + +- The count above a list of trails now reads "35 trails" when every trail is shown, instead of "35 of 35 trails". When a search or a filter leaves some out it still reads "12 of 35 trails", and it goes back to "35 trails" when everything is cleared. Lists of routes read the same way ("58 routes", "1 of 58 routes"). +- The page and the script that updates it use the same wording, so the count reads the same before and after the script runs. ## 2026-11-18 - The Rae Lakes Loop now has a track - The Rae Lakes Loop now has a track from OpenStreetMap (relation 1710944, under the Open Database Licence, credited to OpenStreetMap contributors). The loop itself is 57.6 km (35.8 miles) in one part, from the junction of the Paradise Valley and Bubbs Creek trails by Woods Creek, the Rae Lakes and Glen Pass. The 1.9 mile stem from Road's End to that junction is kept apart, as an alternate. diff --git a/web/assets/app.js b/web/assets/app.js index a274232..5101b5a 100644 --- a/web/assets/app.js +++ b/web/assets/app.js @@ -1545,7 +1545,13 @@ return out; } - return { passes: passes, count: count }; + /* The words after the figure of the count above a list: "trails" when every one is shown, + "of 35 trails" when some are left out. */ + function countWords(shown, total, noun) { + return (shown === total ? '' : 'of ' + total + ' ') + noun; + } + + return { passes: passes, count: count, countWords: countWords }; })(); /* facet-counts:end */ @@ -1926,13 +1932,14 @@ ol.hidden = !any; if (head && head.classList.contains('results__group')) head.hidden = !any; }); - var text = shown.length + ' of ' + total + ' ' + noun; + var words = FacetCount.countWords(shown.length, total, noun); + var text = shown.length + ' ' + words; if (count && count.textContent !== text) { count.innerHTML = ''; var strong = document.createElement('strong'); strong.textContent = String(shown.length); count.appendChild(strong); - count.appendChild(document.createTextNode(' of ' + total + ' ' + noun)); + count.appendChild(document.createTextNode(' ' + words)); } if (empty) empty.hidden = shown.length > 0; if (listHead) listHead.hidden = shown.length === 0; diff --git a/web/olt/home.py b/web/olt/home.py index 29049be..d67337e 100644 --- a/web/olt/home.py +++ b/web/olt/home.py @@ -578,7 +578,7 @@ def results(recs=None, *, finder=False, groups=None, routes_list=False, default_ lists += f'\n
    \n{rows}\n
' if finder: count = (f'

' - f'{total} of {total} {noun}

') + f'{total} {noun}

') empty = f"""