diff options
author | Joris | 2025-01-26 17:58:57 +0100 |
---|---|---|
committer | Joris | 2025-01-26 17:58:57 +0100 |
commit | 24eeb54a6b7159964e8887ade7fa5173b50feb3a (patch) | |
tree | 91af6253df784445db9b084b02b38b37a83224e8 /src/controller/error.rs | |
parent | c5759f348e70cf54b4bfa4cd17e1fe1828ead30a (diff) |
Replace tera by minijinjamain
tera was doing the job all right, but minijinja has fewer dependencies.
Diffstat (limited to 'src/controller/error.rs')
-rw-r--r-- | src/controller/error.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/controller/error.rs b/src/controller/error.rs index 0f6dcc1..fb1375c 100644 --- a/src/controller/error.rs +++ b/src/controller/error.rs @@ -3,7 +3,6 @@ use hyper::body::Bytes; use hyper::header::CACHE_CONTROL; use hyper::Response; use std::collections::HashMap; -use tera::{Context, Tera}; use crate::controller::utils; use crate::controller::wallet::Wallet; @@ -24,14 +23,15 @@ pub fn error( pub fn template( assets: &HashMap<String, String>, - templates: &Tera, + templates: &minijinja::Environment<'_>, title: &str, message: &str, ) -> String { - let mut context = Context::new(); - context.insert("title", title); - context.insert("message", message); - context.insert("assets", assets); + let context = minijinja::context!( + title => title, + message => message, + assets => assets + ); - templates.render("error.html", &context).unwrap() + templates.render_str("error.html", &context).unwrap() } |