about summary refs log tree commit diff
path: root/src/handlers.rs
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-04-09T21·37+0200
committerVincent Ambo <tazjin@gmail.com>2018-04-09T21·37+0200
commit103a59485fbb47e44740a976fb846791b8df0802 (patch)
tree864a7b0c74f79124785df51c70c34495b0f1bf10 /src/handlers.rs
parentfb7df7a34680524cd269d12e6b49fa487cef38b3 (diff)
feat(handlers/templates): Add "New Thread" handler and template
Diffstat (limited to 'src/handlers.rs')
-rw-r--r--src/handlers.rs9
1 files changed, 9 insertions, 0 deletions
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<AppState>, thread_id: Path<i32>) -> ConverseRes
         .responder()
 }
 
+/// This handler presents the user with the "New Thread" form.
+pub fn new_thread(state: State<AppState>) -> Result<HttpResponse> {
+    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,