From d7b56941887eb62a154d06025fee4e1af85e40e9 Mon Sep 17 00:00:00 2001 From: Franz Dietrich Date: Wed, 7 Feb 2024 21:10:24 +0100 Subject: [PATCH] Add TimeOfDate handlebars helper --- terminwahl_back/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terminwahl_back/src/main.rs b/terminwahl_back/src/main.rs index a0c08a1..491af93 100644 --- a/terminwahl_back/src/main.rs +++ b/terminwahl_back/src/main.rs @@ -11,7 +11,7 @@ use handlebars::{DirectorySourceOptions, Handlebars}; use lettre::{transport::smtp::authentication::Credentials, AsyncSmtpTransport, Tokio1Executor}; use log::debug; use std::env; -use terminwahl_back::{api, db, views, CssPath}; +use terminwahl_back::{api, db, handlebars_helper::TimeOfDate, views, CssPath}; #[actix_web::main] async fn main() -> std::io::Result<()> { @@ -40,6 +40,7 @@ async fn main() -> std::io::Result<()> { .build(); let mut handlebars = Handlebars::new(); + handlebars.register_helper("time_of", Box::new(TimeOfDate)); let handlebars_source = DirectorySourceOptions { tpl_extension: ".hbs".to_string(), ..Default::default()