Add TimeOfDate handlebars helper

This commit is contained in:
Franz Dietrich 2024-02-07 21:10:24 +01:00
parent c0efdf8b49
commit d7b5694188

View File

@ -11,7 +11,7 @@ use handlebars::{DirectorySourceOptions, Handlebars};
use lettre::{transport::smtp::authentication::Credentials, AsyncSmtpTransport, Tokio1Executor}; use lettre::{transport::smtp::authentication::Credentials, AsyncSmtpTransport, Tokio1Executor};
use log::debug; use log::debug;
use std::env; use std::env;
use terminwahl_back::{api, db, views, CssPath}; use terminwahl_back::{api, db, handlebars_helper::TimeOfDate, views, CssPath};
#[actix_web::main] #[actix_web::main]
async fn main() -> std::io::Result<()> { async fn main() -> std::io::Result<()> {
@ -40,6 +40,7 @@ async fn main() -> std::io::Result<()> {
.build(); .build();
let mut handlebars = Handlebars::new(); let mut handlebars = Handlebars::new();
handlebars.register_helper("time_of", Box::new(TimeOfDate));
let handlebars_source = DirectorySourceOptions { let handlebars_source = DirectorySourceOptions {
tpl_extension: ".hbs".to_string(), tpl_extension: ".hbs".to_string(),
..Default::default() ..Default::default()