Dołącz do atrybutu w Enlive
Czy możliwe jest dołączenie wartości do atrybutu za pomocą enlive?
przykład: mam to
<a href="/item/edit/">edit</a>
i chciałbym to
<a href="/item/edit/123">edit</a>
Obecnie to robię:
(html/defsnippet foo "views/foo.html" [:#main]
[ctxt]
[:a] (html/set-attr :href (str "/item/edit/" (ctxt :id))))
Ale wolałbym nie umieszczać adresu URL w moim kodzie, dodając identyfikator do istniejącego adresu URL
(html/defsnippet foo "views/foo.html" [:#main]
[ctxt]
[:a@href] (html/append (ctxt :id)))