Add Nearest to me to every list's sort control
Choosing it asks the browser for the visitor's position once and orders the list by straight-line distance to the nearest point of each trail's track on the overview map (or its start and end, where it has no track), shown on each row in miles or kilometres. The position stays in the page: it is not stored, sent or put in the address. Trails with no position go last and are counted; a refused or failed request puts the list back in its earlier order with a plain line. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
3ff2281129
commit
d89a5f0da7
4 files changed
+391
-7
No files matched your search
@@ -84,7 +84,8 @@ class SortKeysTest(unittest.TestCase):
|
||||
self.assertIn('<span class="results-sort__label">Sort by</span>', select)
|
||||
self.assertIn('<option value="length-asc" selected>Length, shortest first</option>', select)
|
||||
self.assertEqual([m for m in re.findall(r'<option value="([^"]+)"', select)],
|
||||
[k for k, _ in facets.SORTS])
|
||||
[k for k, _ in facets.SORTS] + ["nearest"])
|
||||
self.assertIn('<option value="nearest">Nearest to me</option>', select)
|
||||
|
||||
def test_old_address_keys_still_work(self):
|
||||
for old, new in [("long", "length-desc"), ("short", "length-asc"),
|
||||
|
||||
Reference in new issue
Block a user