...
This commit is contained in:
@@ -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();
|
||||
|
Reference in New Issue
Block a user