wip
This commit is contained in:
parent
59ab0b7393
commit
933239a52d
60
Cargo.lock
generated
60
Cargo.lock
generated
@ -194,7 +194,9 @@ checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
@ -266,6 +268,30 @@ dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"memoffset",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.16"
|
||||
@ -567,15 +593,15 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
||||
|
||||
[[package]]
|
||||
name = "globset"
|
||||
version = "0.4.13"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
|
||||
checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex",
|
||||
"regex-automata 0.4.3",
|
||||
"regex-syntax 0.8.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -735,17 +761,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ignore"
|
||||
version = "0.4.20"
|
||||
version = "0.4.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
|
||||
checksum = "747ad1b4ae841a78e8aba0d63adbfbeaea26b517b63705d47856b73015d27060"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"globset",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"memchr",
|
||||
"regex",
|
||||
"regex-automata 0.4.3",
|
||||
"same-file",
|
||||
"thread_local",
|
||||
"walkdir",
|
||||
"winapi-util",
|
||||
]
|
||||
@ -853,9 +878,9 @@ checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
version = "0.2.7"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4"
|
||||
checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
@ -909,6 +934,15 @@ version = "2.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mime"
|
||||
version = "0.3.17"
|
||||
@ -1099,8 +1133,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
||||
[[package]]
|
||||
name = "ovlach_data"
|
||||
version = "0.1.0"
|
||||
source = "git+https://glpat-Ju_qUN9Yh8qa5rEnd6T7:glpat-Ju_qUN9Yh8qa5rEnd6T7@gitlab.nanobyte.cz/ondrej/ov-site-api-data.git?tag=v0.0.1#85e59a8c7b2ddf768751a82cde1b70d99ad6147e"
|
||||
source = "git+https://glpat-Ju_qUN9Yh8qa5rEnd6T7:glpat-Ju_qUN9Yh8qa5rEnd6T7@gitlab.nanobyte.cz/ondrej/ov-site-api-data.git?branch=add_missing_fields#16c3522851e763b883c1bdc2a235bad039f943d9"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"rocket",
|
||||
"serde",
|
||||
]
|
||||
@ -1109,6 +1144,7 @@ dependencies = [
|
||||
name = "ovlach_frontend"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"fern",
|
||||
"log",
|
||||
"ovlach_data",
|
||||
|
@ -14,4 +14,5 @@ rocket = { version = "0.5.0", features = ["json"] }
|
||||
rocket_dyn_templates = { version = "0.1.0", features = ["tera"]}
|
||||
reqwest = { version = "0.11", features = ["json"] }
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
ovlach_data = { git = "https://glpat-Ju_qUN9Yh8qa5rEnd6T7:glpat-Ju_qUN9Yh8qa5rEnd6T7@gitlab.nanobyte.cz/ondrej/ov-site-api-data.git", tag = "v0.0.1"}
|
||||
ovlach_data = { git = "https://glpat-Ju_qUN9Yh8qa5rEnd6T7:glpat-Ju_qUN9Yh8qa5rEnd6T7@gitlab.nanobyte.cz/ondrej/ov-site-api-data.git", branch = "add_missing_fields"}
|
||||
chrono = "0.4.31"
|
@ -4,7 +4,7 @@ use std::collections::HashMap;
|
||||
use rocket::{*, fairing::AdHoc};
|
||||
use rocket_dyn_templates::{Template, tera::Value};
|
||||
use ::serde::Deserialize;
|
||||
use tools::tera::{static_filter, translate_filter};
|
||||
use tools::tera::{static_filter, translate_filter, calculate_age, insert_space_every};
|
||||
|
||||
pub mod routes;
|
||||
pub mod services;
|
||||
@ -32,6 +32,8 @@ pub fn rocket_builder() -> Rocket<Build> {
|
||||
Template::try_custom(|engines| {
|
||||
engines.tera.register_filter("static", static_filter);
|
||||
engines.tera.register_filter("translate", translate_filter);
|
||||
engines.tera.register_filter("calculate_age", calculate_age);
|
||||
engines.tera.register_filter("insert_space_every", insert_space_every);
|
||||
Ok(())
|
||||
})
|
||||
).attach(
|
||||
|
@ -9,7 +9,8 @@ use crate::{PresentationConfig, services::cv::fetch_cv_data_from_backend, CVBack
|
||||
#[derive(Serialize, Debug)]
|
||||
struct RootPage {
|
||||
static_host: String,
|
||||
cv: CV
|
||||
cv: CV,
|
||||
download_cv_url: String,
|
||||
}
|
||||
|
||||
#[get("/")]
|
||||
@ -17,7 +18,8 @@ pub async fn index(presentation_config: &State<PresentationConfig>, cv_config: &
|
||||
let context = match fetch_cv_data_from_backend(cv_config.cv_backend_path.clone()).await {
|
||||
Ok(cv) => RootPage {
|
||||
static_host: presentation_config.static_route.clone(),
|
||||
cv
|
||||
cv,
|
||||
download_cv_url: "FIXME!".to_string(),
|
||||
},
|
||||
Err(e) => {
|
||||
error!("Can't fetch CV data from backend {:?}", e);
|
||||
|
@ -1,7 +1,11 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use chrono::{Utc, Datelike};
|
||||
use log::error;
|
||||
use rocket_dyn_templates::tera::{Value, Error};
|
||||
use ovlach_data::cv::chrono::from_string;
|
||||
|
||||
// TODO: tenhle modul je trochu prasacky..
|
||||
|
||||
pub fn static_filter(
|
||||
value: &Value,
|
||||
@ -17,3 +21,47 @@ pub fn translate_filter(
|
||||
) -> Result<Value, Error> {
|
||||
return Ok(rocket_dyn_templates::tera::Value::String(format!("{}", value.as_str().unwrap()))); // TODO: fix-me here!
|
||||
}
|
||||
|
||||
pub fn insert_space_every(
|
||||
value: &Value,
|
||||
args: &HashMap<String, rocket_dyn_templates::tera::Value>
|
||||
) -> Result<Value, Error> {
|
||||
let mut input = value.as_u64().unwrap().to_string();
|
||||
let times = args.get("times").unwrap().as_u64().unwrap();
|
||||
let mut result = String::new();
|
||||
|
||||
for (index, ch) in input.chars().enumerate() {
|
||||
if index > 0 && index as u64 % times == 0 {
|
||||
result.push(' ');
|
||||
}
|
||||
result.push(ch);
|
||||
}
|
||||
|
||||
Ok(rocket_dyn_templates::tera::Value::String(result))
|
||||
}
|
||||
|
||||
pub fn calculate_age(
|
||||
value: &Value,
|
||||
args: &HashMap<String, rocket_dyn_templates::tera::Value>
|
||||
) -> Result<Value, Error> {
|
||||
error!("{:?}", value.as_str());
|
||||
//let s = value.to_string().trim_matches('"'); // TODO: unwrap here!
|
||||
let value = from_string(value.as_str().unwrap().into());
|
||||
match value {
|
||||
Ok(value) => {
|
||||
let current_date = Utc::now().naive_utc().date();
|
||||
let mut age = current_date.year() - value.year();
|
||||
|
||||
// Adjust age if the birthday hasn't occurred yet this year
|
||||
age = if current_date.month() < value.month() ||
|
||||
(current_date.month() == value.month() && current_date.day() < value.day()) {
|
||||
age - 1
|
||||
} else {
|
||||
age
|
||||
};
|
||||
|
||||
Ok(rocket_dyn_templates::tera::Value::String(age.to_string()))
|
||||
}
|
||||
Err(e) => panic!("Can't parse date: {}", e)
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
<header class="d-print-none">
|
||||
<div class="container text-center text-lg-left">
|
||||
<div class="pt-4 clearfix">
|
||||
<h1 class="site-title mb-0">Walter Patterson</h1>
|
||||
<h1 class="site-title mb-0">{{ cv.person.name }} {{ cv.person.surname }}</h1>
|
||||
<div class="site-nav">
|
||||
<nav role="navigation">
|
||||
<ul class="nav justify-content-center">
|
||||
|
@ -18,18 +18,37 @@
|
||||
<div class="header-social mb-3 d-print-none" data-aos="zoom-in" data-aos-delay="200">
|
||||
<nav role="navigation">
|
||||
<ul class="nav justify-content-center">
|
||||
<li class="nav-item"><a class="nav-link" href="https://twitter.com/templateflip" title="Twitter"><i class="fab fa-twitter"></i><span class="menu-title sr-only">Twitter</span></a>
|
||||
</li>
|
||||
<li class="nav-item"><a class="nav-link" href="https://www.facebook.com/templateflip" title="Facebook"><i class="fab fa-facebook"></i><span class="menu-title sr-only">Facebook</span></a>
|
||||
</li>
|
||||
<li class="nav-item"><a class="nav-link" href="https://www.instagram.com/templateflip" title="Instagram"><i class="fab fa-instagram"></i><span class="menu-title sr-only">Instagram</span></a>
|
||||
</li>
|
||||
<li class="nav-item"><a class="nav-link" href="https://github.com/templateflip" title="Github"><i class="fab fa-github"></i><span class="menu-title sr-only">Github</span></a>
|
||||
</li>
|
||||
{% if cv.social.facebook %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ cv.social.facebook }}" title="Facebook"><i class="fab fa-facebook"></i><span class="menu-title sr-only">Facebook</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if cv.social.github %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ cv.social.github }}" title="github"><i class="fab fa-github"></i><span class="menu-title sr-only">Github</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if cv.social.linkedin %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ cv.social.linkedin }}" title="github"><i class="fab fa-linkedin"></i><span class="menu-title sr-only">Linkedin</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if cv.social.instagram %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ cv.social.instagram }}" title="github"><i class="fab fa-instagram"></i><span class="menu-title sr-only">Instagram</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if cv.social.mastodon %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ cv.social.mastodon }}" title="github"><i class="fab fa-mastodon"></i><span class="menu-title sr-only">Mastodon</span></a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="d-print-none"><a class="btn btn-outline-light btn-lg shadow-sm mt-1 me-3" href="material-resume.pdf" data-aos="fade-right" data-aos-delay="700">Download CV</a><a class="btn btn-info btn-lg shadow-sm mt-1" href="#contact" data-aos="fade-left" data-aos-delay="700">Hire Me</a></div>
|
||||
<div class="d-print-none">
|
||||
<a class="btn btn-outline-light btn-lg shadow-sm mt-1 me-3" href="{{ download_cv_url }}" data-aos="fade-right" data-aos-delay="700">{{ "Download CV" | translate }}</a>
|
||||
<a class="btn btn-info btn-lg shadow-sm mt-1" href="#contact" data-aos="fade-left" data-aos-delay="700"> {{ "Hire me" | translate }} </a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -40,9 +59,8 @@
|
||||
<div class="about-section">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<h2 class="h2 fw-light mb-4">About Me</h2>
|
||||
<p>Hello! I’m Walter Patterson. I am passionate about UI/UX design and Web Design. I am a skilled <strong>front-end developer</strong> and master of graphic design tools such as Photoshop and Sketch. I am a quick learner and a team worker that gets the job done.</p>
|
||||
<p>I can easily capitalize on low hanging fruits and quickly maximize timely deliverables for real-time schemas.</p>
|
||||
<h2 class="h2 fw-light mb-4">{{ "About Me" | translate }} </h2>
|
||||
<p>LoremIPSUM chat gpt pomuze!</p>
|
||||
</div>
|
||||
<div class="col-md-5 offset-lg-1">
|
||||
<div class="row mt-2">
|
||||
@ -51,32 +69,28 @@
|
||||
<div class="pb-2 fw-bolder"><i class="far fa-calendar-alt pe-2 text-muted" style="width:24px;opacity:0.85;"></i> Age</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="pb-2">28</div>
|
||||
<div class="pb-2">{{ cv.person.birthday | calculate_age }}</div>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="pb-2 fw-bolder"><i class="far fa-envelope pe-2 text-muted" style="width:24px;opacity:0.85;"></i> Email</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="pb-2">walter@company.com</div>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="pb-2 fw-bolder"><i class="fab fa-skype pe-2 text-muted" style="width:24px;opacity:0.85;"></i> Skype</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="pb-2">username@skype.com</div>
|
||||
<div class="pb-2"> {{ cv.person.email }} </div>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="pb-2 fw-bolder"><i class="fas fa-phone pe-2 text-muted" style="width:24px;opacity:0.85;"></i> Phone</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="pb-2">+0718-111-0011</div>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<div class="pb-2 fw-bolder"><i class="fas fa-map-marker-alt pe-2 text-muted" style="width:24px;opacity:0.85;"></i> Address</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="pb-2">131 W, City Center, New York, U.S.A</div>
|
||||
<div class="pb-2">+ {{cv.person.phone | insert_space_every(times=3) }}</div>
|
||||
</div>
|
||||
{% if cv.person.address %}
|
||||
<div class="col-sm-5">
|
||||
<div class="pb-2 fw-bolder"><i class="fas fa-map-marker-alt pe-2 text-muted" style="width:24px;opacity:0.85;"></i> Address</div>
|
||||
</div>
|
||||
<div class="col-sm-7">
|
||||
<div class="pb-2">{{ cv.person.address }} </div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user