New contact page and better about page

This commit is contained in:
Chris Jean-Marie 2024-10-17 12:31:19 +00:00
parent 2ff05bc500
commit 2f27c6ee68
4 changed files with 29 additions and 2 deletions

View File

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

View File

@ -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<Option<UserData>>,
) -> 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)
}

View File

@ -1,5 +1,7 @@
{% extends "base.html" %}
{% block title %}About{% endblock %}
{% block content %}
This is will give more information about the website
<h1>Welcome to the family!</h1>
<p>This site is dedicated to the Jean-Marie/Forth/Canavan/Romano family</p>
<p>We will have family events, pictures, and links to interesting places</p>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends "base.html" %}
{% block title %}About{% endblock %}
{% block content %}
<h1>Contact Us</h1>
<p>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</p>
{% endblock %}