From c9932b550bc87d82625cb3e9d1acbba3976cdbf4 Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 3 May 2023 16:31:27 +0200 Subject: [PATCH] add faq route --- src/rest/faq.rs | 13 +++++++++++++ src/rest/mod.rs | 2 ++ templates/faq.html.tera | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 src/rest/faq.rs create mode 100644 templates/faq.html.tera diff --git a/src/rest/faq.rs b/src/rest/faq.rs new file mode 100644 index 0000000..155bc12 --- /dev/null +++ b/src/rest/faq.rs @@ -0,0 +1,13 @@ +use rocket::{get, routes, Route}; +use rocket_dyn_templates::{context, Template}; + +use crate::model::user::User; + +#[get("/")] +async fn index(user: User) -> Template { + Template::render("faq", context!(loggedin_user: user)) +} + +pub fn routes() -> Vec { + routes![index] +} diff --git a/src/rest/mod.rs b/src/rest/mod.rs index 78eb77d..1131fac 100644 --- a/src/rest/mod.rs +++ b/src/rest/mod.rs @@ -22,6 +22,7 @@ use crate::model::{ mod admin; mod auth; mod cox; +mod faq; fn amount_days_to_show(is_cox: bool) -> i64 { if is_cox { @@ -138,6 +139,7 @@ pub fn start(db: SqlitePool) -> Rocket { .mount("/auth", auth::routes()) .mount("/cox", cox::routes()) .mount("/admin", admin::routes()) + .mount("/faq", faq::routes()) .mount("/public", FileServer::from("static/")) .register("/", catchers![unauthorized_error]) .attach(Template::fairing()) diff --git a/templates/faq.html.tera b/templates/faq.html.tera new file mode 100644 index 0000000..24d6557 --- /dev/null +++ b/templates/faq.html.tera @@ -0,0 +1,10 @@ +{% import "includes/macros" as macros %} + +{% extends "base" %} + +{% block content %} +FAQ + +{{ loggedin_user.name }} + +{% endblock content %}