From 103a59485fbb47e44740a976fb846791b8df0802 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 9 Apr 2018 23:37:41 +0200 Subject: feat(handlers/templates): Add "New Thread" handler and template --- src/handlers.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/handlers.rs') diff --git a/src/handlers.rs b/src/handlers.rs index c31cdf679b..3af8a8c409 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -81,6 +81,15 @@ pub fn forum_thread(state: State, thread_id: Path) -> ConverseRes .responder() } +/// This handler presents the user with the "New Thread" form. +pub fn new_thread(state: State) -> Result { + let ctx = tera::Context::new(); + let body = state.tera.render("new-thread.html", &ctx)?; + Ok(HttpResponse::Ok() + .content_type("text/html") + .body(body)) +} + #[derive(Deserialize)] pub struct NewThreadForm { pub title: String, -- cgit 1.4.1