use askama::Template; use super::views::{ ListNavigator, Paginated, RoastView, RoasterOptionView, RoasterView, TimelineEventView, TimelineMonthView, }; use crate::domain::roasters::RoasterSortKey; use crate::domain::roasts::RoastSortKey; use crate::domain::timeline::TimelineSortKey; #[derive(Template)] #[template(path = "roasters.html")] pub struct RoastersTemplate { pub nav_active: &'static str, pub is_authenticated: bool, pub roasters: Paginated, pub navigator: ListNavigator, } #[derive(Template)] #[template(path = "partials/roaster_list.html")] pub struct RoasterListTemplate { pub is_authenticated: bool, pub roasters: Paginated, pub navigator: ListNavigator, } #[derive(Template)] #[template(path = "roaster_detail.html")] pub struct RoasterDetailTemplate { pub nav_active: &'static str, pub is_authenticated: bool, pub roaster: RoasterView, pub roasts: Vec, } #[derive(Template)] #[template(path = "roasts.html")] pub struct RoastsTemplate { pub nav_active: &'static str, pub is_authenticated: bool, pub roasts: Paginated, pub roaster_options: Vec, pub navigator: ListNavigator, } #[derive(Template)] #[template(path = "roast_detail.html")] pub struct RoastDetailTemplate { pub nav_active: &'static str, pub is_authenticated: bool, pub roast: RoastView, } #[derive(Template)] #[template(path = "partials/roast_list.html")] pub struct RoastListTemplate { pub is_authenticated: bool, pub roasts: Paginated, pub navigator: ListNavigator, } #[derive(Template)] #[template(path = "timeline.html")] pub struct TimelineTemplate { pub nav_active: &'static str, pub is_authenticated: bool, pub events: Paginated, pub navigator: ListNavigator, pub months: Vec, } #[derive(Template)] #[template(path = "partials/timeline_chunk.html")] pub struct TimelineChunkTemplate { pub events: Paginated, pub navigator: ListNavigator, pub months: Vec, } pub fn render_template(template: T) -> Result { template.render() }