diff --git a/src/build_actix/route.rs b/src/build_actix/route.rs index de96d4b..cfba415 100644 --- a/src/build_actix/route.rs +++ b/src/build_actix/route.rs @@ -28,6 +28,28 @@ pub async fn index( req: HttpRequest ) -> Result { ).await } + +pub async fn rootwork( req: HttpRequest ) -> Result { + // if response Ok return HttpResponseBuilder + HttpResponse::Ok() + // set response content type html + .content_type("text/html") + // set response body to template context + .body( + // render template context + template::TplRootWork { + // lang to value of Accept-Language header + lang : &template::get_lang(&req), + } + // render template context into String + .render() + .map_err( |e| { + eprintln!("error_tplrender : {}", e ); + error::crash( template::get_lang(&req), "error_tplrender" ) + })?, + ).await +} + pub async fn hemp( req: HttpRequest ) -> Result { // if response Ok return HttpResponseBuilder HttpResponse::Ok() @@ -158,6 +180,50 @@ pub async fn robot( req: HttpRequest ) -> Result { ).await } +pub async fn app( req: HttpRequest ) -> Result { + // if response Ok return HttpResponseBuilder + HttpResponse::Ok() + // set response content type html + .content_type("text/html") + // set response body to template context + .body( + // render template context + template::TplApp { + // lang to value of Accept-Language header + lang : &template::get_lang(&req), + } + + // render template context into String + .render() + .map_err( |e| { + eprintln!("error_tplrender : {}", e ); + error::crash( template::get_lang(&req), "error_tplrender" ) + })?, + ).await +} + +pub async fn business( req: HttpRequest ) -> Result { + // if response Ok return HttpResponseBuilder + HttpResponse::Ok() + // set response content type html + .content_type("text/html") + // set response body to template context + .body( + // render template context + template::TplModel { + // lang to value of Accept-Language header + lang : &template::get_lang(&req), + } + + // render template context into String + .render() + .map_err( |e| { + eprintln!("error_tplrender : {}", e ); + error::crash( template::get_lang(&req), "error_tplrender" ) + })?, + ).await +} + diff --git a/src/build_actix/template.rs b/src/build_actix/template.rs index 9155890..a62f527 100644 --- a/src/build_actix/template.rs +++ b/src/build_actix/template.rs @@ -12,6 +12,14 @@ pub struct TplIndex<'a> { pub lang: &'a str, } +#[derive(Template)] +// define path to use template in +#[template(path="app.html")] +pub struct TplRootWork<'a> { + // replace with lang + pub lang: &'a str, +} + #[derive(Template)] // define path to use template in #[template(path="hemp.html")] @@ -52,16 +60,25 @@ pub struct TplOff<'a> { pub lang: &'a str, } - -// test -// info template within index.html +// index info windows #[derive(Template)] -#[template(path="info.html")] +#[template(path="tekla.html")] pub struct TplRobot<'a> { pub lang: &'a str, } +#[derive(Template)] +#[template(path="rootwork.html")] +pub struct TplApp<'a> { + pub lang: &'a str, +} + +#[derive(Template)] +#[template(path="virtual.html")] +pub struct TplModel<'a> { + pub lang: &'a str, +} // linked to error template diff --git a/src/main.rs b/src/main.rs index 3e8e7dc..66a2156 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,14 +19,15 @@ async fn main() -> std::io::Result<()> { .service( fs::Files::new("/assets", "./templates/assets/").index_file("index.html")) .route("/", web::get().to(route::index)) .route("/hemp", web::get().to(route::hemp)) - .route("/spider", web::get().to(route::spider)) + .route("/tekla", web::get().to(route::spider)) + .route("/rootwork", web::get().to(route::rootwork)) .route("/kaoscube", web::get().to(route::cube)) .route("/cyberpreneur", web::get().to(route::cyber)) .route("/offgrid", web::get().to(route::off)) - - // test - // route of link in svg in index.html + // info windows index .route("/robot", web::get().to(route::robot)) + .route("/app", web::get().to(route::app)) + .route("/virtual", web::get().to(route::business)) }) .bind("0.0.0.0:5000")? .run() diff --git a/templates/app.html b/templates/app.html new file mode 100644 index 0000000..f91ae44 --- /dev/null +++ b/templates/app.html @@ -0,0 +1,5 @@ +{% extends "base.html" %} +{% block content %} +

RootWork

+

The social network of plants

+{% endblock %} \ No newline at end of file diff --git a/templates/assets/css/box.css b/templates/assets/css/box.css index bf5e860..c1512de 100644 --- a/templates/assets/css/box.css +++ b/templates/assets/css/box.css @@ -33,6 +33,7 @@ width: inherit; display: grid; grid-template-rows: .5fr .25fr 1fr .45fr; + max-width: inherit; } .content h2 { @@ -171,6 +172,11 @@ input:hover ~ .close { } } +#small { + font-size: 4.9vh; + max-width: inherit; +} + diff --git a/templates/index.html b/templates/index.html index 7f83f66..6b6b2db 100644 --- a/templates/index.html +++ b/templates/index.html @@ -61,13 +61,17 @@ - + + + - + + + diff --git a/templates/nav.html b/templates/nav.html index 526bdcc..084fae6 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -9,8 +9,9 @@