change trips

This commit is contained in:
2023-08-29 21:34:00 +02:00
parent aac192eb97
commit 58bf5bd044
2 changed files with 23 additions and 23 deletions

View File

@@ -101,7 +101,7 @@ impl TripTableRow {
html!(
td ."border" ."p-0" ."m-0" {
a ."inline-block" ."p-2" ."m-0" ."w-full"
href=(format!("/trip/{id}/", id=trip_id))
href=(format!("/trips/{id}/", id=trip_id))
{ (value) }
}
)
@@ -115,7 +115,7 @@ impl NewTrip {
html!(
form
name="new_trip"
action="/trip/"
action="/trips/"
target="_self"
method="post"
."mt-8" ."p-5" ."border-2" ."border-gray-200"
@@ -951,11 +951,11 @@ impl TripItemListRow {
{
a
href={
"/trip/" (trip_id)
"/trips/" (trip_id)
"/items/" (item.item.id)
"/" (if item.picked { "unpick" } else { "pick" }) }
hx-post={
"/trip/" (trip_id)
"/trips/" (trip_id)
"/items/" (item.item.id)
"/" (if item.picked { "unpick" } else { "pick" }) }
hx-target="closest tr"
@@ -993,11 +993,11 @@ impl TripItemListRow {
@if item.picked {
a
href={
"/trip/" (trip_id)
"/trips/" (trip_id)
"/items/" (item.item.id)
"/" (if item.packed { "unpack" } else { "pack" }) }
hx-post={
"/trip/" (trip_id)
"/trips/" (trip_id)
"/items/" (item.item.id)
"/" (if item.packed { "unpack" } else { "pack" }) }
hx-target="closest tr"

View File

@@ -120,30 +120,30 @@ async fn main() -> Result<(), sqlx::Error> {
"/trips/types/:id/edit/name/submit",
post(trips_types_edit_name),
)
.route("/trip/", post(trip_create))
.route("/trip/:id/", get(trip))
.route("/trip/:id/comment/submit", post(trip_comment_set))
.route("/trip/:id/state/:id", post(trip_state_set))
.route("/trip/:id/type/:id/add", get(trip_type_add))
.route("/trip/:id/type/:id/remove", get(trip_type_remove))
.route("/trips/", post(trip_create))
.route("/trips/:id/", get(trip))
.route("/trips/:id/comment/submit", post(trip_comment_set))
.route("/trips/:id/state/:id", post(trip_state_set))
.route("/trips/:id/type/:id/add", get(trip_type_add))
.route("/trips/:id/type/:id/remove", get(trip_type_remove))
.route(
"/trip/:id/edit/:attribute/submit",
"/trips/:id/edit/:attribute/submit",
post(trip_edit_attribute),
)
.route(
"/trip/:id/items/:id/pick",
"/trips/:id/items/:id/pick",
get(trip_item_set_pick).post(trip_item_set_pick_htmx),
)
.route(
"/trip/:id/items/:id/unpick",
"/trips/:id/items/:id/unpick",
get(trip_item_set_unpick).post(trip_item_set_unpick_htmx),
)
.route(
"/trip/:id/items/:id/pack",
"/trips/:id/items/:id/pack",
get(trip_item_set_pack).post(trip_item_set_pack_htmx),
)
.route(
"/trip/:id/items/:id/unpack",
"/trips/:id/items/:id/unpack",
get(trip_item_set_unpack).post(trip_item_set_unpack_htmx),
)
.route("/inventory/", get(inventory_inactive))
@@ -652,7 +652,7 @@ async fn trip_create(
),
})?;
Ok(Redirect::to(&format!("/trip/{id}/", id = id)))
Ok(Redirect::to(&format!("/trips/{id}/", id = id)))
}
async fn trips(
@@ -820,7 +820,7 @@ async fn trip_type_remove(
ErrorPage::build(&format!("type {type_id} is not active for trip {trip_id}")),
))
} else {
Ok(Redirect::to(&format!("/trip/{trip_id}/")))
Ok(Redirect::to(&format!("/trips/{trip_id}/")))
}
}
@@ -886,7 +886,7 @@ async fn trip_type_add(
),
})?;
Ok(Redirect::to(&format!("/trip/{trip_id}/")))
Ok(Redirect::to(&format!("/trips/{trip_id}/")))
}
#[derive(Deserialize)]
@@ -918,7 +918,7 @@ async fn trip_comment_set(
ErrorPage::build(&format!("trip with id {id} not found", id = trip_id)),
))
} else {
Ok(Redirect::to(&format!("/trip/{id}/", id = trip_id)))
Ok(Redirect::to(&format!("/trips/{id}/", id = trip_id)))
}
}
@@ -959,7 +959,7 @@ async fn trip_edit_attribute(
ErrorPage::build(&format!("trip with id {id} not found", id = trip_id)),
))
} else {
Ok(Redirect::to(&format!("/trip/{trip_id}/")))
Ok(Redirect::to(&format!("/trips/{trip_id}/")))
}
}
@@ -1262,7 +1262,7 @@ async fn trip_state_set(
ErrorPage::build(&format!("trip with id {id} not found", id = trip_id)),
))
} else {
Ok(Redirect::to(&format!("/trip/{id}/", id = trip_id)))
Ok(Redirect::to(&format!("/trips/{id}/", id = trip_id)))
}
}