Recipe edit (WIP): add API to set some recipe values
This commit is contained in:
parent
c6dfff065c
commit
dd05a673d9
20 changed files with 690 additions and 2189 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue