This commit is contained in:
Ondrej Vlach 2023-11-26 17:31:20 +01:00
parent d5a30b5951
commit e6fc26c1fc
6 changed files with 448 additions and 376 deletions

2
Rocket.toml Normal file
View File

@ -0,0 +1,2 @@
[debug]
static_route = "http://localhost:8001"

33
data/cv/ovlach.yaml Normal file
View File

@ -0,0 +1,33 @@
person:
name: Ondrej
surname: Vlach
education:
- from: 2022
to: 2023
school: blabla
jobs:
- jobtype: FREELANCE
from: 20/12/1986
to: 21/12/1986
company: blabla
title: blabla
description: blabla
languages:
- PHP
- HTML
- CSS
- JavaScript
- MySQL
- Wordpress
- Bootstrap
technologies:
- name: PHP
techtype: LANGUAGE
- name: HTML
techtype: LANGUAGE
- name: CSS
techtype: LANGUAGE

View File

@ -1,12 +1,40 @@
use rocket::*; use std::collections::HashMap;
use rocket_dyn_templates::Template;
use rocket::{*, fairing::AdHoc};
use rocket_dyn_templates::{Template, tera::Value};
use ::serde::Deserialize;
pub mod routes; pub mod routes;
#[derive(Deserialize)]
#[serde(crate = "rocket::serde")]
pub struct PresentationConfig {
static_route: String,
}
pub fn static_filter(
value: &Value,
args: &HashMap<String, rocket_dyn_templates::tera::Value>
) -> Result<Value, rocket_dyn_templates::tera::Error> {
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!
}
pub fn rocket_builder() -> Rocket<Build> { pub fn rocket_builder() -> Rocket<Build> {
rocket::build().attach( let rocket = rocket::build();
Template::fairing() //let figment = rocket.figment();
// extract the entire config any `Deserialize` value
//let config: PresentationConfig = figment.extract().expect("config");
rocket.attach(
Template::try_custom(|engines| {
engines.tera.register_filter("static", static_filter);
Ok(())
})
).attach(
AdHoc::config::<PresentationConfig>()
).mount("/", routes![ ).mount("/", routes![
routes::root::index routes::root::index
]) ])

View File

@ -1,14 +1,18 @@
use rocket::get; use rocket::{get, State, config};
use rocket_dyn_templates::Template; use rocket_dyn_templates::Template;
use serde::Serialize; use serde::Serialize;
#[derive(Serialize, Debug)] use crate::PresentationConfig;
struct Test {
#[derive(Serialize, Debug)]
struct RootPage {
static_host: String,
} }
#[get("/")] #[get("/")]
pub fn index() -> Template { pub fn index(config: &State<PresentationConfig>) -> Template {
let context = Test {}; let context = RootPage {
static_host: config.static_route.clone(),
};
Template::render("default", &context) Template::render("default", &context)
} }

85
templates/base.html.tera Normal file
View File

@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Material Resume</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="crossorigin"/>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&amp;family=Roboto:wght@300;400;500;700&amp;display=swap"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&amp;family=Roboto:wght@300;400;500;700&amp;display=swap" media="print" onload="this.media='all'"/>
<noscript>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&amp;family=Roboto:wght@300;400;500;700&amp;display=swap"/>
</noscript>
<link href="{{ "css/font-awesome/css/all.min.css?ver=1.2.1" | static(static_host = static_host) }}" rel="stylesheet">
<link href="{{ "css/mdb.min.css?ver=1.2.1" | static(static_host = static_host) }}" rel="stylesheet">
<link href="{{ "css/aos.css?ver=1.2.1" | static(static_host = static_host) }}" rel="stylesheet">
<link href="{{ "css/main.css?ver=1.2.1" | static(static_host = static_host) }}" rel="stylesheet">
<noscript>
<style type="text/css">
[data-aos] {
opacity: 1 !important;
transform: translate(0) scale(1) !important;
}
</style>
</noscript>
</head>
<body class="bg-light" id="top">
<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>
<div class="site-nav">
<nav role="navigation">
<ul class="nav justify-content-center">
<li class="nav-item"><a class="nav-link" href="#about" title="About"><span class="menu-title">About</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#skills" title="Skills"><span class="menu-title">Skills</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#experience" title="Experience"><span class="menu-title">Experience</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#education" title="Education"><span class="menu-title">Education</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#portfolio" title="Portfolio"><span class="menu-title">Portfolio</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#references" title="References"><span class="menu-title">References</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#contact" title="Contact"><span class="menu-title">Contact</span></a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
{% block content %} {% endblock content %}
<footer class="pt-4 pb-4 text-muted text-center d-print-none">
<div class="container">
<div class="my-3">
<div class="h4">Walter Patterson</div>
<div class="footer-nav">
<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>
</ul>
</nav>
</div>
</div>
<div class="text-small">
<div class="mb-1">&copy; Material Resume. All rights reserved.</div>
<div>Design - <a href="https://templateflip.com/" target="_blank">TemplateFlip</a></div>
</div>
</div>
</footer>
<script src="{{ "scripts/mdb.min.js?ver=1.2.1" | static(static_host = static_host) }}"></script>
<script src="{{ "scripts/aos.js?ver=1.2.1" | static(static_host = static_host) }}"></script>
<script src="{{ "scripts/main.js?ver=1.2.1" | static(static_host = static_host) }}"></script>
</body>
</html>

View File

@ -1,63 +1,12 @@
<!DOCTYPE html> {% extends "base" %}
<html lang="en-US">
<head> {% block content %}
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Material Resume</title>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="crossorigin"/>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&amp;family=Roboto:wght@300;400;500;700&amp;display=swap"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&amp;family=Roboto:wght@300;400;500;700&amp;display=swap" media="print" onload="this.media='all'"/>
<noscript>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:wght@600&amp;family=Roboto:wght@300;400;500;700&amp;display=swap"/>
</noscript>
<link href="css/font-awesome/css/all.min.css?ver=1.2.1" rel="stylesheet">
<link href="css/mdb.min.css?ver=1.2.1" rel="stylesheet">
<link href="css/aos.css?ver=1.2.1" rel="stylesheet">
<link href="css/main.css?ver=1.2.1" rel="stylesheet">
<noscript>
<style type="text/css">
[data-aos] {
opacity: 1 !important;
transform: translate(0) scale(1) !important;
}
</style>
</noscript>
</head>
<body class="bg-light" id="top">
<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>
<div class="site-nav">
<nav role="navigation">
<ul class="nav justify-content-center">
<li class="nav-item"><a class="nav-link" href="#about" title="About"><span class="menu-title">About</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#skills" title="Skills"><span class="menu-title">Skills</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#experience" title="Experience"><span class="menu-title">Experience</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#education" title="Education"><span class="menu-title">Education</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#portfolio" title="Portfolio"><span class="menu-title">Portfolio</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#references" title="References"><span class="menu-title">References</span></a>
</li>
<li class="nav-item"><a class="nav-link" href="#contact" title="Contact"><span class="menu-title">Contact</span></a>
</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<div class="page-content"> <div class="page-content">
<div class="container"> <div class="container">
<div class="resume-container"> <div class="resume-container">
<div class="shadow-1-strong bg-white my-5" id="intro"> <div class="shadow-1-strong bg-white my-5" id="intro">
<div class="bg-info text-white"> <div class="bg-info text-white">
<div class="cover bg-image"><img src="images/header-background.jpg"/> <div class="cover bg-image"><img src="{{ "images/header-background.jpg" | static(static_host = static_host) }}" />
<div class="mask" style="background-color: rgba(0, 0, 0, 0.7);backdrop-filter: blur(2px);"> <div class="mask" style="background-color: rgba(0, 0, 0, 0.7);backdrop-filter: blur(2px);">
<div class="text-center p-5"> <div class="text-center p-5">
<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>
@ -351,33 +300,4 @@
</div> </div>
</div></div> </div></div>
</div> </div>
<footer class="pt-4 pb-4 text-muted text-center d-print-none"> {% endblock content %}
<div class="container">
<div class="my-3">
<div class="h4">Walter Patterson</div>
<div class="footer-nav">
<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>
</ul>
</nav>
</div>
</div>
<div class="text-small">
<div class="mb-1">&copy; Material Resume. All rights reserved.</div>
<div>Design - <a href="https://templateflip.com/" target="_blank">TemplateFlip</a></div>
</div>
</div>
</footer>
<script src="scripts/mdb.min.js?ver=1.2.1"></script>
<script src="scripts/aos.js?ver=1.2.1"></script>
<script src="scripts/main.js?ver=1.2.1"></script>
</body>
</html>