mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 10:02:18 +00:00
23 lines
477 B
Rust
23 lines
477 B
Rust
use askama::Template;
|
|
use askama_web::WebTemplate;
|
|
use rustical_store::auth::Principal;
|
|
|
|
use crate::pages::DefaultLayoutData;
|
|
|
|
pub trait Section: Template {
|
|
fn name() -> &'static str;
|
|
}
|
|
|
|
#[derive(Template, WebTemplate)]
|
|
#[template(path = "pages/user.html")]
|
|
pub struct UserPage<S: Section> {
|
|
pub user: Principal,
|
|
pub section: S,
|
|
}
|
|
|
|
impl<S: Section> DefaultLayoutData for UserPage<S> {
|
|
fn get_user(&self) -> Option<&Principal> {
|
|
Some(&self.user)
|
|
}
|
|
}
|