add error page

This commit is contained in:
blek 2023-10-13 23:37:03 +10:00
parent ff7324d089
commit 41e98c2245
Signed by: blek
GPG Key ID: 14546221E3595D0C
2 changed files with 39 additions and 0 deletions

View File

@ -68,6 +68,17 @@ pub struct TOSPage {
pub env: Env
}
#[derive(Template)]
#[template( path = "error.html" )]
#[allow(dead_code)]
pub struct ErrorPage {
pub env: Env,
pub error_text: String,
pub link: Option<String>,
pub link_text: Option<String>
}
pub async fn uploaded(query: HashMap<String, String>, state: SharedState) -> Result<Html<String>, Rejection> {
if ! query.contains_key("file") {

View File

@ -0,0 +1,28 @@
{% extends "base.html" %}
{% block body %}
<div style="max-width:95vw;width:fit-content;margin:0 auto">
<h1 style="text-align:center">Error</h1>
<p style='text-align:center'>
<svg xmlns="http://www.w3.org/2000/svg" width="52" height="52" fill="currentColor" class="bi bi-x-lg" viewBox="0 0 16 16">
<path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8 2.146 2.854Z"/>
</svg>
</p>
<p>{{ error_text }}</p>
{% match link %}
{% when Some with (lnk) %}
<a href="{{ lnk }}" class="btn btn-fill" style="display:block">
{% match link_text %}
{% when Some with (text) %}
{{ text }}
{% when None %}
Go to {{ lnk }}
{% endmatch %}
</a>
{% when None -%}
{% endmatch %}
</div>
{% endblock %}