[TASK] translate alerts
This commit is contained in:
parent
52b245b14e
commit
8ebc06e445
@ -43,7 +43,7 @@ async fn delete(db: &State<SqlitePool>, _admin: AdminUser, boat: i32) -> Flash<R
|
|||||||
boat.delete(db).await;
|
boat.delete(db).await;
|
||||||
Flash::success(
|
Flash::success(
|
||||||
Redirect::to("/admin/boat"),
|
Redirect::to("/admin/boat"),
|
||||||
format!("Sucessfully deleted boat {}", boat.name),
|
format!("Boot {} gelöscht", boat.name),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
None => Flash::error(Redirect::to("/admin/boat"), "Boat does not exist"),
|
None => Flash::error(Redirect::to("/admin/boat"), "Boat does not exist"),
|
||||||
@ -63,7 +63,7 @@ async fn update(
|
|||||||
};
|
};
|
||||||
|
|
||||||
match boat.update(db, data.into_inner()).await {
|
match boat.update(db, data.into_inner()).await {
|
||||||
Ok(_) => Flash::success(Redirect::to("/admin/boat"), "Successfully updated boat"),
|
Ok(_) => Flash::success(Redirect::to("/admin/boat"), "Boot bearbeitet"),
|
||||||
Err(e) => Flash::error(Redirect::to("/admin/boat"), e),
|
Err(e) => Flash::error(Redirect::to("/admin/boat"), e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ async fn create(
|
|||||||
_admin: AdminUser,
|
_admin: AdminUser,
|
||||||
) -> Flash<Redirect> {
|
) -> Flash<Redirect> {
|
||||||
match Boat::create(db, data.into_inner()).await {
|
match Boat::create(db, data.into_inner()).await {
|
||||||
Ok(_) => Flash::success(Redirect::to("/admin/boat"), "Successfully created boat"),
|
Ok(_) => Flash::success(Redirect::to("/admin/boat"), "Boot hinzugefügt"),
|
||||||
Err(e) => Flash::error(Redirect::to("/admin/boat"), e),
|
Err(e) => Flash::error(Redirect::to("/admin/boat"), e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ async fn create(
|
|||||||
|
|
||||||
PlannedEvent::create(db, data.name, data.planned_amount_cox, trip_details).await;
|
PlannedEvent::create(db, data.name, data.planned_amount_cox, trip_details).await;
|
||||||
|
|
||||||
Flash::success(Redirect::to("/"), "Successfully planned the event")
|
Flash::success(Redirect::to("/"), "Event hinzugefügt")
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: add constraints (e.g. planned_amount_cox > 0)
|
//TODO: add constraints (e.g. planned_amount_cox > 0)
|
||||||
@ -79,7 +79,7 @@ async fn delete(db: &State<SqlitePool>, id: i64, _admin: AdminUser) -> Flash<Red
|
|||||||
match PlannedEvent::find_by_id(db, id).await {
|
match PlannedEvent::find_by_id(db, id).await {
|
||||||
Some(planned_event) => {
|
Some(planned_event) => {
|
||||||
planned_event.delete(db).await;
|
planned_event.delete(db).await;
|
||||||
Flash::success(Redirect::to("/"), "Successfully deleted the event")
|
Flash::success(Redirect::to("/"), "Event gelöscht")
|
||||||
}
|
}
|
||||||
None => Flash::error(Redirect::to("/"), "PlannedEvent does not exist"),
|
None => Flash::error(Redirect::to("/"), "PlannedEvent does not exist"),
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ async fn resetpw(db: &State<SqlitePool>, _admin: AdminUser, user: i32) -> Flash<
|
|||||||
user.reset_pw(db).await;
|
user.reset_pw(db).await;
|
||||||
Flash::success(
|
Flash::success(
|
||||||
Redirect::to("/admin/user"),
|
Redirect::to("/admin/user"),
|
||||||
format!("Successfully reset pw of {}", user.name),
|
format!("Passwort von {} zurückgesetzt", user.name),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
None => Flash::error(Redirect::to("/admin/user"), "User does not exist"),
|
None => Flash::error(Redirect::to("/admin/user"), "User does not exist"),
|
||||||
@ -50,7 +50,7 @@ async fn delete(db: &State<SqlitePool>, _admin: AdminUser, user: i32) -> Flash<R
|
|||||||
user.delete(db).await;
|
user.delete(db).await;
|
||||||
Flash::success(
|
Flash::success(
|
||||||
Redirect::to("/admin/user"),
|
Redirect::to("/admin/user"),
|
||||||
format!("Sucessfully deleted user {}", user.name),
|
format!("Benutzer {} gelöscht", user.name),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
None => Flash::error(Redirect::to("/admin/user"), "User does not exist"),
|
None => Flash::error(Redirect::to("/admin/user"), "User does not exist"),
|
||||||
|
@ -133,7 +133,7 @@ async fn fixed<'r>(
|
|||||||
user_id_fixed: coxuser.id as i32,
|
user_id_fixed: coxuser.id as i32,
|
||||||
};
|
};
|
||||||
match boatdamage.fixed(db, boatdamage_fixed).await {
|
match boatdamage.fixed(db, boatdamage_fixed).await {
|
||||||
Ok(_) => Flash::success(Redirect::to("/boatdamage"), "Successfully fixed the boat."),
|
Ok(_) => Flash::success(Redirect::to("/boatdamage"), "Bootsschaden behoben."),
|
||||||
Err(e) => Flash::error(Redirect::to("/boatdamage"), format!("Error: {e}")),
|
Err(e) => Flash::error(Redirect::to("/boatdamage"), format!("Error: {e}")),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ async fn verified<'r>(
|
|||||||
match boatdamage.verified(db, boatdamage_verified).await {
|
match boatdamage.verified(db, boatdamage_verified).await {
|
||||||
Ok(_) => Flash::success(
|
Ok(_) => Flash::success(
|
||||||
Redirect::to("/boatdamage"),
|
Redirect::to("/boatdamage"),
|
||||||
"Successfully verified the boat.",
|
"Bootsschaden verifiziert",
|
||||||
),
|
),
|
||||||
Err(e) => Flash::error(Redirect::to("/boatdamage"), format!("Error: {e}")),
|
Err(e) => Flash::error(Redirect::to("/boatdamage"), format!("Error: {e}")),
|
||||||
}
|
}
|
||||||
|
@ -208,11 +208,11 @@ async fn home_logbook(
|
|||||||
};
|
};
|
||||||
|
|
||||||
match logbook.home(db, user, data.into_inner()).await {
|
match logbook.home(db, user, data.into_inner()).await {
|
||||||
Ok(_) => Flash::success(Redirect::to("/log"), "Successfully updated log"),
|
Ok(_) => Flash::success(Redirect::to("/log"), "Ausfahrt korrekt eingetragen"),
|
||||||
Err(LogbookUpdateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")),
|
Err(LogbookUpdateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")),
|
||||||
Err(_) => Flash::error(
|
Err(_) => Flash::error(
|
||||||
Redirect::to("/log"),
|
Redirect::to("/log"),
|
||||||
format!("Logbook with ID {} could not be updated!", logbook_id),
|
format!("Eintrag {} konnte nicht abgesendet werden!", logbook_id),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -253,7 +253,7 @@ async fn delete(db: &State<SqlitePool>, logbook_id: i32, user: User) -> Flash<Re
|
|||||||
match logbook.delete(db, &user).await {
|
match logbook.delete(db, &user).await {
|
||||||
Ok(_) => Flash::success(
|
Ok(_) => Flash::success(
|
||||||
Redirect::to("/log"),
|
Redirect::to("/log"),
|
||||||
format!("Logbook with ID {} successfully deleted!", logbook_id),
|
format!("Eintrag {} gelöscht!", logbook_id),
|
||||||
),
|
),
|
||||||
Err(LogbookDeleteError::NotYourEntry) => Flash::error(
|
Err(LogbookDeleteError::NotYourEntry) => Flash::error(
|
||||||
Redirect::to("/log"),
|
Redirect::to("/log"),
|
||||||
@ -282,7 +282,7 @@ async fn delete_kiosk(
|
|||||||
match logbook.delete(db, &cox).await {
|
match logbook.delete(db, &cox).await {
|
||||||
Ok(_) => Flash::success(
|
Ok(_) => Flash::success(
|
||||||
Redirect::to("/log"),
|
Redirect::to("/log"),
|
||||||
format!("Logbook with ID {} successfully deleted!", logbook_id),
|
format!("Eintrag {} gelöscht!", logbook_id),
|
||||||
),
|
),
|
||||||
Err(LogbookDeleteError::NotYourEntry) => Flash::error(
|
Err(LogbookDeleteError::NotYourEntry) => Flash::error(
|
||||||
Redirect::to("/log"),
|
Redirect::to("/log"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user