Show a trail's park, range and wilderness links at the foot of its page on a phone, where the glance hides them

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Sonnet 5.5 committed 2026-11-20 12:29:57 -07:00
1 parent 3182d68935
commit 2a56815f34
3 files changed
+30

No files matched your search

+4
View File
@@ -2108,7 +2108,11 @@ td .linklist a { font-weight: 400; }
/* Below the two-column page the panel shows its first facts, so the map is on the first screen;
a button opens the rest. Without JavaScript every fact shows and the button is not offered. */
.glance__toggle { display: none; }
/* The place links also stand alone at the foot of the page on a narrow screen, where the glance
keeps the Where row behind its button; on a wide one the glance shows them. */
.trail-places { display: none; margin-block-start: 0; margin-block-end: var(--space-6); }
@media (max-width: 63.99rem) {
html.js .trail-places { display: block; }
html.js .glance:not([data-all]) .glance__facts > div:nth-child(n+5),
html.js .glance:not([data-all]) > .note { display: none; }
html.js .glance__toggle {
+13
View File
@@ -92,6 +92,18 @@ def place_links(rec, infos):
return Markup(", ".join(f'<a href="{esc(i["path"])}">{esc(i["name"])}</a>' for i in mine))
def places_nav(rec, infos):
"""The same place links as the glance's Where row, as a line at the foot of the page. On a
phone the glance shows only its first facts until "All the facts" is tapped, and the Where
row is not among them; this line is shown there (style.css, .trail-places) so the links are
on the page without a tap. "" when the trail is in no place that has a page."""
links = place_links(rec, infos)
if not links:
return ""
return Markup(f'<nav class="region-nav trail-places" aria-label="Parks, ranges and wilderness areas">'
f'Parks, ranges and wilderness areas: {links}</nav>')
_ORG_CUT = re.compile(r", who |, with | publishes |; (?=[a-z])| \((?=[a-z])| \((?=[^)]*geometry)")
@@ -1879,6 +1891,7 @@ def render(rec, site, records=None, author_links=None, place_infos=()):
{profile}
</div>
<div class="container trail-more">
{places_nav(rec, place_infos)}
{onward(rec, records, place_infos)}
{page_foot(rec, site)}
{about_data(rec, site, author_links)}
+13
View File
@@ -126,6 +126,19 @@ class TrailLinkTest(unittest.TestCase):
self.assertNotIn("/parks/small/", body)
self.assertIn("More in the Wind River Range", body) # the ways onward
def test_the_place_links_are_also_on_the_page_for_a_phone_outside_the_glance(self):
body = str(trail.render(self.rec, S, self.records, place_infos=self.infos)[2])
foot = body[body.index('class="container trail-more"'):]
self.assertIn('<nav class="region-nav trail-places"', foot)
self.assertIn('<a href="/ranges/wind-river-range/">Wind River Range</a>',
foot[:foot.index("</nav>")])
self.assertLess(foot.index("trail-places"), foot.index('class="onward"'))
css = open(os.path.join(WEB, "assets", "style.css"), encoding="utf-8").read()
narrow = css[css.index("@media (max-width: 63.99rem)", css.index(".trail-places")):]
self.assertIn("html.js .trail-places { display: block; }", narrow[:200])
plain = str(trail.render(self.rec, S, self.records)[2])
self.assertNotIn("trail-places", plain)
def test_a_trail_with_no_place_page_is_unchanged(self):
plain = str(trail.render(self.rec, S, self.records)[2])
self.assertNotIn("/ranges/wind-river-range/", plain)