feat(handlers/templates): Add "New Thread" handler and template

This commit is contained in:
Vincent Ambo 2018-04-09 23:37:41 +02:00
parent fb7df7a346
commit 103a59485f
3 changed files with 62 additions and 1 deletions

View file

@ -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,