This commit is contained in:
2025-04-19 19:59:28 +02:00
parent 17a11fb43c
commit 1fa0b30169
5 changed files with 680 additions and 0 deletions

View File

@@ -6,6 +6,20 @@ use crate::models::User;
pub struct HomeController;
impl HomeController {
/// Handles the markdown editor page route
pub async fn editor(tmpl: web::Data<Tera>) -> Result<impl Responder> {
let mut ctx = tera::Context::new();
ctx.insert("active_page", "editor");
let rendered = tmpl.render("editor.html", &ctx)
.map_err(|e| {
eprintln!("Template rendering error: {}", e);
actix_web::error::ErrorInternalServerError("Template rendering error")
})?;
Ok(HttpResponse::Ok().content_type("text/html").body(rendered))
}
/// Handles the home page route
pub async fn index(tmpl: web::Data<Tera>) -> Result<impl Responder> {
let mut ctx = tera::Context::new();