From 2f27c6ee681f48362025bcf534d00de0564d68e9 Mon Sep 17 00:00:00 2001 From: Chris Jean-Marie Date: Thu, 17 Oct 2024 12:31:19 +0000 Subject: [PATCH] New contact page and better about page --- backend/src/main.rs | 3 ++- backend/src/routes.rs | 18 ++++++++++++++++++ backend/templates/about.html | 4 +++- backend/templates/contactus.html | 6 ++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 backend/templates/contactus.html diff --git a/backend/src/main.rs b/backend/src/main.rs index 280adeb..07906a9 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -15,7 +15,7 @@ mod user; use error_handling::AppError; use middlewares::inject_user_data; use google_oauth::{login, logout, google_auth_return}; -use routes::{dashboard, index, about, profile, user_profile, useradmin}; +use routes::{dashboard, index, about, contact, profile, user_profile, useradmin}; use user::{add_user_role, delete_user_role, UserData}; #[derive(Clone)] @@ -56,6 +56,7 @@ async fn main() { .fallback(get_service(ServeDir::new("templates/assets")))) .route("/", get(index)) .route("/about", get(about)) + .route("/contactus", get(contact)) .route("/login", get(login)) .route("/logout", get(logout)) .route("/google_auth_return", get(google_auth_return)) diff --git a/backend/src/routes.rs b/backend/src/routes.rs index 12bf930..45c09e0 100644 --- a/backend/src/routes.rs +++ b/backend/src/routes.rs @@ -196,3 +196,21 @@ pub async fn about( HtmlTemplate(template) } + +#[derive(Template)] +#[template(path = "contactus.html")] +struct ContactTemplate { + logged_in: bool, + name: String, +} + +pub async fn contact( + Extension(user_data): Extension>, +) -> impl IntoResponse { + let user_name = user_data.map(|s| s.name); + let logged_in = user_name.is_some(); + let name = user_name.unwrap_or_default(); + + let template = ContactTemplate { logged_in, name }; + HtmlTemplate(template) +} \ No newline at end of file diff --git a/backend/templates/about.html b/backend/templates/about.html index 3c3b140..2f28267 100644 --- a/backend/templates/about.html +++ b/backend/templates/about.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% block title %}About{% endblock %} {% block content %} -This is will give more information about the website +

Welcome to the family!

+

This site is dedicated to the Jean-Marie/Forth/Canavan/Romano family

+

We will have family events, pictures, and links to interesting places

{% endblock %} diff --git a/backend/templates/contactus.html b/backend/templates/contactus.html new file mode 100644 index 0000000..223da6c --- /dev/null +++ b/backend/templates/contactus.html @@ -0,0 +1,6 @@ +{% extends "base.html" %} +{% block title %}About{% endblock %} +{% block content %} +

Contact Us

+

If you would like to have access to the website, use the login menu. At this time it will require you to login with a Google account. Once your account has been verified, you will be given access to the dashboard

+{% endblock %} \ No newline at end of file