Convert add_purchase.js to TypeScript; drop dead add_edition.js (issue #17)

- Add ts/add_purchase.ts: typed port of add_purchase.js. Replaces getEl with
  document.querySelector; types the search-select:change CustomEvent detail
  (SearchSelectChangeDetail / SearchSelectOption)
- Point add_purchase / edit_purchase views at compiled dist/add_purchase.js
- Delete add_edition.js: no Edition model/view/url/template references it
  (feature was removed; the script was dead)
- Delete the now-superseded add_game.js / add_purchase.js source files
- Tighten test_rendered_pages assertions to the dist/ script paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-19 13:27:05 +02:00
parent b03d9241fc
commit daae9b8944
5 changed files with 35 additions and 59 deletions
+3 -3
View File
@@ -194,7 +194,7 @@ def _pricing_controls() -> Node:
By default the form's own single Price field is the bundle price. When 2+
games are selected and "Separate price per game" is checked, the per-game
inputs (the general ``selection-fields`` element) take over and the bundle
Price is hidden. Toggle/visibility wiring lives in add_purchase.js; the
Price is hidden. Toggle/visibility wiring lives in ts/add_purchase.ts; the
hidden ``pricing_mode`` tells the view which path to take.
"""
return Div(attributes=[("id", "pricing-controls")])[
@@ -301,7 +301,7 @@ def add_purchase(request: HttpRequest, game_id: int = 0) -> HttpResponse:
),
title="Add New Purchase",
scripts=mark_safe(
ModuleScript("search_select.js") + ModuleScript("add_purchase.js")
ModuleScript("search_select.js") + ModuleScript("dist/add_purchase.js")
),
)
@@ -319,7 +319,7 @@ def edit_purchase(request: HttpRequest, purchase_id: int) -> HttpResponse:
AddForm(form, request=request, additional_row=_purchase_additional_row()),
title="Edit Purchase",
scripts=mark_safe(
ModuleScript("search_select.js") + ModuleScript("add_purchase.js")
ModuleScript("search_select.js") + ModuleScript("dist/add_purchase.js")
),
)