feat(ssr): migrate location-select to a Selmer template (Phase 2 — Selmer validated)
First interactive Transaction Edit component rendered from a Selmer template instead of
Hiccup/com/select, proving the render-file path + the Hiccup<->Selmer interop bridge on
real, e2e-covered markup.
- resources/templates/components/location-select.html: plain-HTML <select> with a
{% for %} over option maps + {% if opt.selected %}.
- location-select*: build options/selected/classes in Clojure (reusing
inputs/default-input-classes so styling can't drift), render via
sel/render->hiccup, and embed the fragment back into the still-Hiccup account row.
- skill: finalize selmer-conventions.md from this validated example (was a stub); add the
cookbook entry; scorecard marks the first Selmer component.
Verified on a fresh server: full suite 38 pass / 1 unrelated fail, swap 6/6,
transaction-edit 8/8 -- the Shared Location test selects through the Selmer <select>,
saves, and spreads Shared -> DT. Verified by string-match + e2e (not byte-parity:
hh/add-class is set-based so class order differs, CSS is order-independent).
Scope note: the modal's remaining attribute-heavy components delegate to the shared
com/typeahead / com/select / com/button-group-button; converting those is the
cross-cutting Phase 11 Selmer sweep, not a single-modal change (Open decision 2).
This commit is contained in:
@@ -90,6 +90,25 @@ replaces the amount input (caret survives).
|
||||
:placeholder "Optional note"}) ; no hx-* — rides along to save
|
||||
```
|
||||
|
||||
## location-select — first Selmer-migrated component (validated)
|
||||
|
||||
The account row's location `<select>`, rendered from a Selmer template instead of
|
||||
`com/select`. The first interactive modal component off Hiccup; proves the render-file
|
||||
path + interop bridge on real, e2e-covered markup (swap 6/6, transaction-edit 8/8).
|
||||
|
||||
```clojure
|
||||
;; templates/components/location-select.html — plain HTML, {% for %} + {% if selected %}
|
||||
(defn location-select* [{:keys [name client-locations value ...]}]
|
||||
(let [options (cond ...) ; [[value label] ...]
|
||||
selected (or value (ffirst options))
|
||||
classes (str/join " " (conj (vec inputs/default-input-classes) "w-full"))]
|
||||
(sel/render->hiccup "templates/components/location-select.html"
|
||||
{:name name :classes classes
|
||||
:options (for [[v l] options] {:value v :label l :selected (= v selected)})})))
|
||||
```
|
||||
Reuse: pass `inputs/default-input-classes` in (don't hard-code); embed via
|
||||
`render->hiccup` so it drops into the still-Hiccup row. See `selmer-conventions.md`.
|
||||
|
||||
## fixed-index row from explicit data — de-faking a deep cursor
|
||||
|
||||
When a row always lives at a known index (e.g. simple mode renders exactly `accounts[0]`),
|
||||
|
||||
Reference in New Issue
Block a user