Recipe edit (WIP): add API to set some recipe values

This commit is contained in:
Greg Burri 2024-12-23 01:37:01 +01:00
parent c6dfff065c
commit dd05a673d9
20 changed files with 690 additions and 2189 deletions

View file

@ -3,10 +3,17 @@ use askama::Template;
use crate::data::model;
pub struct Recipes {
pub list: Vec<(i64, String)>,
pub published: Vec<(i64, String)>,
pub unpublished: Vec<(i64, String)>,
pub current_id: Option<i64>,
}
impl Recipes {
pub fn is_current(&self, id: &&i64) -> bool {
self.current_id == Some(**id)
}
}
#[derive(Template)]
#[template(path = "home.html")]
pub struct HomeTemplate {
@ -111,3 +118,10 @@ pub struct RecipeEditTemplate {
pub recipe: model::Recipe,
pub languages: [(&'static str, &'static str); 2],
}
#[derive(Template)]
#[template(path = "recipes_list_fragment.html")]
pub struct RecipesListFragmentTemplate {
pub user: Option<model::User>,
pub recipes: Recipes,
}