Remove unused 'title' variable from base template

This commit is contained in:
Matthew Gordon 2024-03-02 20:39:01 -04:00
parent 3d4a34611b
commit 7f7277da2d
3 changed files with 6 additions and 14 deletions

View File

@ -19,10 +19,8 @@ pub fn routes<D: Database>() -> Router<AppState<D>> {
#[derive(Template)] #[derive(Template)]
#[template(path = "index.html")] #[template(path = "index.html")]
struct IndexTemplate<'a> { struct IndexTemplate {}
title: &'a str,
}
async fn root<'a>() -> IndexTemplate<'a> { async fn root() -> IndexTemplate {
IndexTemplate { title: "Locality" } IndexTemplate {}
} }

View File

@ -130,20 +130,14 @@ impl std::error::Error for Error {
#[derive(Template)] #[derive(Template)]
#[template(path = "error.html")] #[template(path = "error.html")]
struct ErrorTemplate<'a> { struct ErrorTemplate {}
title: &'a str,
}
impl IntoResponse for Error { impl IntoResponse for Error {
fn into_response(self) -> Response { fn into_response(self) -> Response {
match self.error_type { match self.error_type {
ErrorType::InternalServerError => { ErrorType::InternalServerError => {
error!(inner = self.inner, "Uncaught error producing HTTP 500."); error!(inner = self.inner, "Uncaught error producing HTTP 500.");
( (StatusCode::INTERNAL_SERVER_ERROR, ErrorTemplate {}).into_response()
StatusCode::INTERNAL_SERVER_ERROR,
ErrorTemplate { title: "Error" },
)
.into_response()
} }
ErrorType::Unauthorized => { ErrorType::Unauthorized => {
(StatusCode::UNAUTHORIZED, "User not authorized.").into_response() (StatusCode::UNAUTHORIZED, "User not authorized.").into_response()

View File

@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
<title>{% block title %}{{title}} - Locality{% endblock %}</title> <title>{% block title %}Locality{% endblock %}</title>
<link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32.png"> <link rel="icon" type="image/png" sizes="32x32" href="/static/favicon-32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16.png"> <link rel="icon" type="image/png" sizes="16x16" href="/static/favicon-16.png">