diff --git a/bincio/edit/server.py b/bincio/edit/server.py
index 21e6f70..d00f43f 100644
--- a/bincio/edit/server.py
+++ b/bincio/edit/server.py
@@ -48,293 +48,7 @@ from bincio.shared.images import MAX_IMAGE_BYTES as _MAX_IMAGE_BYTES
from bincio.shared.images import unique_image_name as _unique_image_name
-# ── HTML UI ───────────────────────────────────────────────────────────────────
-
-_HTML = """\
-
-
-
-
-
-Edit Activity
-
-
-
-
-
-
-
-
-"""
+_TEMPLATE_PATH = Path(__file__).parent / "templates" / "edit.html"
# ── Routes ────────────────────────────────────────────────────────────────────
@@ -359,13 +73,12 @@ async def edit_page(activity_id: str) -> str:
f''
for s in STAT_PANELS
)
- html = (
- _HTML
+ return (
+ _TEMPLATE_PATH.read_text(encoding="utf-8")
.replace("__SITE_URL__", site_url)
.replace("__SPORT_OPTIONS__", sport_opts)
.replace("__STAT_CHECKBOXES__", stat_cbs)
)
- return html
@app.get("/api/activity/{activity_id}")
diff --git a/bincio/edit/templates/edit.html b/bincio/edit/templates/edit.html
new file mode 100644
index 0000000..91bfb05
--- /dev/null
+++ b/bincio/edit/templates/edit.html
@@ -0,0 +1,283 @@
+
+
+
+
+
+Edit Activity
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/refactoring.md b/refactoring.md
index 7b72d33..267baa0 100644
--- a/refactoring.md
+++ b/refactoring.md
@@ -490,7 +490,7 @@ def test_activity_geojson_missing_geometry(client, tmp_path, authenticated_sessi
| # | Step | Status |
|---|---|---|
| 1 | Extract shared image utilities → `bincio/shared/images.py` | Done |
-| 2 | Extract HTML template → `bincio/edit/templates/edit.html` | Not started |
+| 2 | Extract HTML template → `bincio/edit/templates/edit.html` | Done |
| 3 | Split `serve/server.py` into `deps.py` + `routers/*` | Not started |
| 4 | Narrow broad `except Exception:` catches | Not started |
diff --git a/tests/test_edit_server.py b/tests/test_edit_server.py
index 3b15837..145d581 100644
--- a/tests/test_edit_server.py
+++ b/tests/test_edit_server.py
@@ -156,3 +156,34 @@ class TestDemEndpoint:
monkeypatch.setattr(edit_server, "dem_url", "https://api.open-elevation.com")
r = CLIENT.post("/api/activity/../../evil/recalculate-elevation/dem")
assert r.status_code in (400, 404, 422)
+
+
+# ── /edit/{activity_id} HTML template ────────────────────────────────────────
+
+class TestEditPage:
+ AID = "2024-01-01T080000Z-my-ride"
+
+ def test_returns_200_html(self):
+ r = CLIENT.get(f"/edit/{self.AID}")
+ assert r.status_code == 200
+ assert r.headers["content-type"].startswith("text/html")
+
+ def test_contains_form(self):
+ r = CLIENT.get(f"/edit/{self.AID}")
+ assert '