teo_generator/admin/
pages_page_records.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use askama::Template;
use teo_runtime::model::Model;
use teo_runtime::namespace::Namespace;
use crate::utils::file::FileUtil;

#[derive(Template)]
#[template(path = "admin/src/components/generated/pages/page/Records.tsx.jinja", escape = "none")]
pub(self) struct PagesPageRecordsTemplate {
    name: String
}

pub(crate) async fn generate_pages_page_records_tsx(_namespace: &Namespace, _model: &Model, display_name: &str, path: &str, file_util: &FileUtil) -> teo_result::Result<()> {
    let template = PagesPageRecordsTemplate {
        name: display_name.to_owned()
    };
    file_util.ensure_directory_and_generate_file(
        &format!("src/components/generated/pages/{path}/Records.tsx"),
        template.render().unwrap()
    ).await?;
    Ok(())
}