Invite corrections: links on every page, issue forms, site checks
Validate / validate (push) Canceled after 0s
Validate / site (push) Canceled after 0s

Each trail's page now offers "Report a problem" (a GitHub form with the
record filled in), "Edit this record" and "History". The footer, the
home page and About link to the forms for a wrong record and a missing
trail, and Logos links to a form for a steward or creator who wants a
track or logo removed or re-credited. The links are built only when
repo_url in web/site.toml is a github.com repository.

.github/ has the three issue forms and a pull request checklist, and
the workflow also runs the site's tests and a build, on Python 3.12.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-13 13:17:20 -07:00
1 parent 1760ae4da9
commit 30c306ecc6
13 files changed
+377 -12

No files matched your search

+51 -1
View File
@@ -17,7 +17,7 @@ WEB = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ROOT = os.path.dirname(WEB)
sys.path.insert(0, WEB)
from olt import layout, pages, records, site, trail, words # noqa: E402
from olt import home, layout, pages, records, site, trail, words # noqa: E402
OUT = os.path.join(WEB, ".cache", "test-site")
@@ -412,6 +412,56 @@ class RenderUnitTest(unittest.TestCase):
self.assertNotIn("/issues", layout.footer(site.Site("N", "T")))
self.assertIn("https://example.org/repo/issues", layout.footer(site.Site("N", "T", repo_url="https://example.org/repo")))
def test_trail_correction_links_github(self):
gh = site.Site("N", "T", repo_url="https://github.com/swaits/longhikes")
_, _, body, _ = trail.render(sample_record("A & B Trail"), gh)
plain = html.unescape(body)
self.assertIn("Report a problem", plain)
self.assertIn("https://github.com/swaits/longhikes/issues/new?"
"template=correction.yml&title=Correction%3A+A+%26+B+Trail+%28x%29&trail=x", plain)
self.assertIn("Edit this record", plain)
self.assertIn("https://github.com/swaits/longhikes/edit/main/x/trail.toml", plain)
self.assertIn("History", plain)
self.assertIn("https://github.com/swaits/longhikes/commits/main/x", plain)
def test_trail_correction_links_github_branch(self):
gh = site.Site("N", "T", repo_url="https://github.com/o/r/", repo_branch="dev")
block = html.unescape(trail.correction_block(sample_record("X Trail"), gh))
self.assertIn("https://github.com/o/r/edit/dev/x/trail.toml", block)
self.assertIn("https://github.com/o/r/commits/dev/x", block)
def test_trail_correction_links_non_github_fall_back_to_repo(self):
other = site.Site("N", "T", repo_url="https://example.org/repo")
block = html.unescape(trail.correction_block(sample_record("X Trail"), other))
self.assertIn('href="https://example.org/repo"', block)
self.assertNotIn("template=correction.yml", block)
self.assertNotIn("/edit/", block)
self.assertNotIn("/commits/", block)
self.assertNotIn("Edit this record", block)
def test_trail_correction_links_empty_repo_url(self):
block = trail.correction_block(sample_record("X Trail"), site.Site("N", "T"))
self.assertEqual(block, "")
self.assertNotIn("github.com", layout.footer(site.Site("N", "T")))
self.assertNotIn("Suggest a trail", layout.footer(site.Site("N", "T")))
def test_footer_and_home_contribute_links_github(self):
gh = site.Site("N", "T", repo_url="https://github.com/swaits/longhikes")
footer = html.unescape(layout.footer(gh))
self.assertIn("Fix or add a trail", footer)
self.assertIn('href="https://github.com/swaits/longhikes"', footer)
self.assertIn("Suggest a trail", footer)
self.assertIn("https://github.com/swaits/longhikes/issues/new?template=new-trail.yml", footer)
body = html.unescape(home.render([sample_record("X Trail")], gh))
self.assertIn("https://github.com/swaits/longhikes/issues/new?template=new-trail.yml", body)
def test_footer_contribute_links_non_github_have_no_github_forms(self):
other = site.Site("N", "T", repo_url="https://example.org/repo")
footer = html.unescape(layout.footer(other))
self.assertIn('href="https://example.org/repo"', footer)
self.assertNotIn("template=", footer)
self.assertNotIn("github.com", footer)
def test_render_site_on_a_synthetic_record(self):
with tempfile.TemporaryDirectory() as tmp:
repo, out = os.path.join(tmp, "repo"), os.path.join(tmp, "out")