feat(handlers/templates): Add "New Thread" handler and template
This commit is contained in:
parent
fb7df7a346
commit
103a59485f
3 changed files with 62 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue