Add Askama templates with base.html.

This commit is contained in:
Bauke 2022-10-06 18:53:45 +02:00
parent 163502505a
commit 958e04c47b
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
6 changed files with 86 additions and 0 deletions

64
Cargo.lock generated
View File

@ -139,6 +139,54 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "askama"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb98f10f371286b177db5eeb9a6e5396609555686a35e1d4f7b9a9c6d8af0139"
dependencies = [
"askama_derive",
"askama_escape",
"askama_shared",
]
[[package]]
name = "askama_derive"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87bf87e6e8b47264efa9bde63d6225c6276a52e05e91bf37eaa8afd0032d6b71"
dependencies = [
"askama_shared",
"proc-macro2",
"syn",
]
[[package]]
name = "askama_escape"
version = "0.10.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "619743e34b5ba4e9703bba34deac3427c72507c7159f5fd030aea8cac0cfe341"
[[package]]
name = "askama_shared"
version = "0.12.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf722b94118a07fcbc6640190f247334027685d4e218b794dbfe17c32bf38ed0"
dependencies = [
"askama_escape",
"humansize",
"mime",
"mime_guess",
"nom 7.1.1",
"num-traits",
"percent-encoding",
"proc-macro2",
"quote",
"serde",
"syn",
"toml",
]
[[package]] [[package]]
name = "async-attributes" name = "async-attributes"
version = "1.1.2" version = "1.1.2"
@ -1333,6 +1381,12 @@ version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904"
[[package]]
name = "humansize"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026"
[[package]] [[package]]
name = "iana-time-zone" name = "iana-time-zone"
version = "0.1.50" version = "0.1.50"
@ -2988,6 +3042,7 @@ dependencies = [
name = "tildes-statistics" name = "tildes-statistics"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"askama",
"async-std", "async-std",
"chrono", "chrono",
"clap 4.0.10", "clap 4.0.10",
@ -3094,6 +3149,15 @@ dependencies = [
"pin-project-lite", "pin-project-lite",
] ]
[[package]]
name = "toml"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.36" version = "0.1.36"

View File

@ -12,6 +12,7 @@ name = "tildes-statistics"
path = "source/main.rs" path = "source/main.rs"
[dependencies] [dependencies]
askama = "0.11.1"
async-std = "1.12.0" async-std = "1.12.0"
chrono = "0.4.22" chrono = "0.4.22"
color-eyre = "0.6.2" color-eyre = "0.6.2"

2
askama.toml Normal file
View File

@ -0,0 +1,2 @@
[general]
dirs = ["source/templates"]

View File

@ -15,6 +15,7 @@ pub mod cli;
pub mod group_data; pub mod group_data;
pub mod migrations; pub mod migrations;
pub mod snapshots; pub mod snapshots;
pub mod templates;
pub mod utilities; pub mod utilities;
/// The entities code is auto-generated using `sea-orm-cli`. With a database /// The entities code is auto-generated using `sea-orm-cli`. With a database

View File

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ page_title }}</title>
<link rel="stylesheet" href="/css/modern-normalize.css">
{% block head %}{% endblock %}
</head>
<body>
{% block body %}{% endblock %}
</body>
</html>

1
source/templates/mod.rs Normal file
View File

@ -0,0 +1 @@
//! All HTML templates.