🚚 Errors 403 and 404 are base components

This commit is contained in:
Manuel Cillero 2023-11-20 18:42:08 +01:00
parent e25cf3eecc
commit 62b32ebcee
4 changed files with 18 additions and 9 deletions

View file

@ -136,21 +136,34 @@ pub mod flex;
mod icon;
pub use icon::Icon;
mod heading;
pub use heading::{Heading, HeadingDisplay, HeadingType};
mod paragraph;
pub use paragraph::Paragraph;
mod button;
pub use button::{Button, ButtonTarget, ButtonType};
mod image;
pub use image::{Image, ImageSize};
mod block;
pub use block::Block;
mod branding;
pub use branding::Branding;
mod powered_by;
pub use powered_by::{PoweredBy, PoweredByLogo};
mod error403;
pub use error403::Error403;
mod error404;
pub use error404::Error404;
pub mod menu;
pub use menu::Menu;

View file

@ -7,7 +7,7 @@ pub struct Error403;
impl ComponentTrait for Error403 {
fn new() -> Self {
Self
Error403
}
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {

View file

@ -7,7 +7,7 @@ pub struct Error404;
impl ComponentTrait for Error404 {
fn new() -> Self {
Self
Error404
}
fn prepare_component(&self, _cx: &mut Context) -> PrepareMarkup {

View file

@ -1,8 +1,4 @@
mod error403;
pub use error403::Error403;
mod error404;
pub use error404::Error404;
use crate::base::component::{Error403, Error404};
use crate::locale::L10n;
use crate::response::{page::Page, ResponseError};
use crate::service::http::{header::ContentType, StatusCode};
@ -33,7 +29,7 @@ impl fmt::Display for FatalError {
let error_page = Page::new(request.clone());
if let Ok(page) = error_page
.with_title(L10n::n("Error FORBIDDEN"))
.with_in("content", error403::Error403)
.with_in("content", Error403)
.with_template("error")
.render()
{
@ -47,7 +43,7 @@ impl fmt::Display for FatalError {
let error_page = Page::new(request.clone());
if let Ok(page) = error_page
.with_title(L10n::n("Error RESOURCE NOT FOUND"))
.with_in("content", error404::Error404)
.with_in("content", Error404)
.with_template("error")
.render()
{