Rebuild the site for people browsing trails
The site read like a database. It is now a place to find and read about long trails, and everything on it is still derived from the records. - One kind of thing: a trail. A route is a kind of trail, explained where the word first appears. The navigation is Trails, Places, About. - The home page is the catalogue, with filters for where, length, time, season, terrain, kind, walking, shape and GPX. A filter is offered only when at least a third of the trails have a value for it. - Lists (for example National Scenic Trails and Routes) and a Places page that groups states and provinces into regions. - A trail page leads with what a hiker needs: summary, at a glance, map, downloads, elevation profile and where to go next. The dataset's own fields sit in a collapsed "About this data" section. - The trail list is a compact card on phones and beside the filters, and a column table where it has the full page width. - web/serve.py takes --bind, for viewing from another device. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
efb6164737
commit
b817d2097b
21 files changed
+3468
-719
No files matched your search
+7
-31
@@ -129,39 +129,15 @@ def absent_reason_short(rec):
|
||||
return re.sub(r"^No (?:line|track) is included\.\s*", "", reason) or reason
|
||||
|
||||
|
||||
def regions_html(rec, linked=False):
|
||||
"""Region codes with their names; optionally each linked to the filtered list."""
|
||||
parts = []
|
||||
for code in rec.get("regions", []):
|
||||
name = words.region_name(code)
|
||||
if code == words.ALL_CANADA:
|
||||
text = Markup(esc(name))
|
||||
href = "/regions/#canada-wide"
|
||||
else:
|
||||
text = Markup(f'<abbr title="{esc(name)}">{esc(code)}</abbr>')
|
||||
href = f"/regions/{words.region_key(code, rec['country']).lower()}/"
|
||||
if linked:
|
||||
text = Markup(f'<a href="{esc(href)}">{text}</a>')
|
||||
parts.append(text)
|
||||
return Markup(" ".join(parts))
|
||||
|
||||
|
||||
def tags(rec, with_policy=True):
|
||||
"""Kind, tier and listing tags, and (with_policy) the track policy of a route."""
|
||||
def badges(rec, *, route_tag=True):
|
||||
"""The badges a hiker needs on a row or a trail page: Route (linked to what a route is)
|
||||
and National Scenic Trail. An official trail has no badge for its kind.
|
||||
route_tag=False leaves the Route badge out (the Routes list, where every row is one)."""
|
||||
out = []
|
||||
if is_route(rec):
|
||||
out.append('<span class="tag tag--route">Person-defined route</span>')
|
||||
elif rec.get("tier") == "national":
|
||||
if route_tag and is_route(rec):
|
||||
out.append('<a class="tag tag--route" href="/routes/">Route</a>')
|
||||
if rec.get("tier") == "national":
|
||||
out.append('<span class="tag tag--nst">National Scenic Trail</span>')
|
||||
else:
|
||||
out.append('<span class="tag">Designated trail</span>')
|
||||
tier = rec.get("tier")
|
||||
if tier in ("short", "deferred", "candidate"):
|
||||
out.append(f'<span class="tag tag--quiet">{esc(words.label(words.TIERS, tier))}</span>')
|
||||
if str(rec.get("wave")) == "held":
|
||||
out.append('<span class="tag tag--quiet">Held</span>')
|
||||
if is_route(rec) and with_policy:
|
||||
out.append(policy_chip(policy(rec)))
|
||||
return Markup("".join(out))
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user