wip
This commit is contained in:
parent
b65b1a7a54
commit
ab3dbaf0fa
@ -4,7 +4,7 @@ use std::collections::HashMap;
|
|||||||
use rocket::{*, fairing::AdHoc};
|
use rocket::{*, fairing::AdHoc};
|
||||||
use rocket_dyn_templates::{Template, tera::Value};
|
use rocket_dyn_templates::{Template, tera::Value};
|
||||||
use ::serde::Deserialize;
|
use ::serde::Deserialize;
|
||||||
use tools::tera::static_filter;
|
use tools::tera::{static_filter, translate_filter};
|
||||||
|
|
||||||
pub mod routes;
|
pub mod routes;
|
||||||
pub mod services;
|
pub mod services;
|
||||||
@ -31,6 +31,7 @@ pub fn rocket_builder() -> Rocket<Build> {
|
|||||||
rocket.attach(
|
rocket.attach(
|
||||||
Template::try_custom(|engines| {
|
Template::try_custom(|engines| {
|
||||||
engines.tera.register_filter("static", static_filter);
|
engines.tera.register_filter("static", static_filter);
|
||||||
|
engines.tera.register_filter("translate", translate_filter);
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
).attach(
|
).attach(
|
||||||
|
@ -9,4 +9,11 @@ pub fn static_filter(
|
|||||||
) -> Result<Value, Error> {
|
) -> Result<Value, Error> {
|
||||||
let host = args.get("static_host");
|
let host = args.get("static_host");
|
||||||
return Ok(rocket_dyn_templates::tera::Value::String(format!("{}/{}", host.unwrap().as_str().unwrap(), value.as_str().unwrap()))); // TODO: fix-me here!
|
return Ok(rocket_dyn_templates::tera::Value::String(format!("{}/{}", host.unwrap().as_str().unwrap(), value.as_str().unwrap()))); // TODO: fix-me here!
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn translate_filter(
|
||||||
|
value: &Value,
|
||||||
|
args: &HashMap<String, rocket_dyn_templates::tera::Value>
|
||||||
|
) -> Result<Value, Error> {
|
||||||
|
return Ok(rocket_dyn_templates::tera::Value::String(format!("{}", value.as_str().unwrap()))); // TODO: fix-me here!
|
||||||
}
|
}
|
@ -12,8 +12,8 @@
|
|||||||
<div class="avatar p-1"><img class="img-thumbnail shadow-2-strong" src="images/avatar.jpg" width="160" height="160"/></div>
|
<div class="avatar p-1"><img class="img-thumbnail shadow-2-strong" src="images/avatar.jpg" width="160" height="160"/></div>
|
||||||
<div class="header-bio mt-3">
|
<div class="header-bio mt-3">
|
||||||
<div data-aos="zoom-in" data-aos-delay="0">
|
<div data-aos="zoom-in" data-aos-delay="0">
|
||||||
<h2 class="h1">Walter Patterson</h2>
|
<h2 class="h1"> {{ cv.person.name }} {{ cv.person.surname }} </h2>
|
||||||
<p>Front-end Developer and Graphic Designer</p>
|
<p>{{ "Frontend and web developer" | translate }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="header-social mb-3 d-print-none" data-aos="zoom-in" data-aos-delay="200">
|
<div class="header-social mb-3 d-print-none" data-aos="zoom-in" data-aos-delay="200">
|
||||||
<nav role="navigation">
|
<nav role="navigation">
|
||||||
|
Loading…
Reference in New Issue
Block a user