feat: Updates form routes and database routes to use id's in the url path.

This commit is contained in:
2026-01-09 09:25:37 -05:00
parent 9356ccb1c9
commit 30fddb9dce
27 changed files with 677 additions and 322 deletions

View File

@@ -27,6 +27,13 @@ struct RoomForm: HTML, Sendable {
self.room = room
}
var route: String {
SiteRoute.View.router.path(
for: .project(.detail(projectID, .rooms(.index)))
)
.appendingPath(room?.id)
}
var body: some HTML {
ModalForm(id: id, dismiss: dismiss) {
h1(.class("text-3xl font-bold pb-6")) { "Room" }
@@ -34,8 +41,8 @@ struct RoomForm: HTML, Sendable {
.class("modal-backdrop"),
.init(name: "method", value: "dialog"),
room == nil
? .hx.post(route: .project(.detail(projectID, .rooms(.index))))
: .hx.patch(route: .project(.detail(projectID, .rooms(.index)))),
? .hx.post(route)
: .hx.patch(route),
.hx.target("body"),
.hx.swap(.outerHTML)
) {