add error page
This commit is contained in:
parent
ff7324d089
commit
41e98c2245
|
@ -68,6 +68,17 @@ pub struct TOSPage {
|
||||||
pub env: Env
|
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> {
|
pub async fn uploaded(query: HashMap<String, String>, state: SharedState) -> Result<Html<String>, Rejection> {
|
||||||
|
|
||||||
if ! query.contains_key("file") {
|
if ! query.contains_key("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 %}
|
Loading…
Reference in New Issue