Current recipe id was not set

This commit is contained in:
Greg Burri 2025-04-21 19:37:09 +02:00
parent 812ba9dc3b
commit 9dccd553bc
5 changed files with 28 additions and 12 deletions

View file

@ -22,8 +22,13 @@ pub async fn recipes_list_fragments(
) -> Result<impl IntoResponse> {
Ok(Html(
RecipesListFragmentTemplate {
recipes: Recipes::new(connection, &context.user, context.tr.current_lang_code())
.await?,
recipes: Recipes::new(
connection,
&context.user,
context.tr.current_lang_code(),
current_recipe.current_recipe_id,
)
.await?,
context,
}
.render()?,

View file

@ -53,8 +53,13 @@ pub async fn home_page(
) -> Result<impl IntoResponse> {
Ok(Html(
HomeTemplate {
recipes: Recipes::new(connection, &context.user, context.tr.current_lang_code())
.await?,
recipes: Recipes::new(
connection,
&context.user,
context.tr.current_lang_code(),
None,
)
.await?,
context,
}
.render()?,
@ -79,8 +84,13 @@ pub async fn dev_panel(
if context.user.is_some() && context.user.as_ref().unwrap().is_admin {
Ok(Html(
DevPanelTemplate {
recipes: Recipes::new(connection, &context.user, context.tr.current_lang_code())
.await?,
recipes: Recipes::new(
connection,
&context.user,
context.tr.current_lang_code(),
None,
)
.await?,
context,
log,
current_log_file: log_file.log_file.clone(),

View file

@ -4,7 +4,6 @@ use axum::{
extract::{Extension, Path, State},
response::{Html, IntoResponse, Redirect, Response},
};
// use tracing::{event, Level};
use crate::{
Context, Result,
@ -49,6 +48,7 @@ pub async fn edit(
connection,
&context.user,
context.tr.current_lang_code(),
Some(recipe_id),
)
.await?,
context,
@ -112,6 +112,7 @@ pub async fn view(
connection,
&context.user,
context.tr.current_lang_code(),
Some(recipe_id),
)
.await?,
context,