🎉 [bootsier] Saca tema del código base de PageTop

This commit is contained in:
Manuel Cillero 2023-02-02 08:54:43 +01:00
parent b95a154a34
commit da4c1e097e
10 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,23 @@
[package]
name = "pagetop-bootsier"
version = "0.0.1"
edition = "2021"
authors = [
"Manuel Cillero <manuel@cillero.es>"
]
description = """\
Theme for PageTop that uses the Bootstrap framework for page layout and component display.\
"""
homepage = "https://pagetop.cillero.es"
repository = "https://github.com/manuelcillero/pagetop"
license = "Apache-2.0 OR MIT"
[dependencies]
pagetop = { path = "../pagetop", version = "0.0" }
pagetop-jquery = { path = "../pagetop-jquery", version = "0.0" }
static-files = "0.2.3"
maud = "0.24.0"
[build-dependencies]
pagetop-build = { path = "../pagetop-build", version = "0.0" }

View file

@ -0,0 +1,27 @@
Tema para **PageTop** que utiliza el *framework* [Bootstrap](https://getbootstrap.com/) para la
composición de páginas y visualización de componentes.
[PageTop](https://github.com/manuelcillero/pagetop/tree/main/pagetop), es un entorno de desarrollo
basado en algunos de los *crates* más estables y populares del ecosistema Rust para proporcionar
APIs, patrones de desarrollo y buenas prácticas para la creación de soluciones web SSR (*Server-Side
Rendering*).
# 🚧 Advertencia
**PageTop** sólo libera actualmente versiones de desarrollo. La API no es estable y los cambios son
constantes. No puede considerarse preparado hasta que se libere la versión **0.1.0**.
# 📜 Licencia
Este proyecto tiene licencia, de hecho tiene dos, puedes aplicar cualquiera de las siguientes a tu
elección:
* Licencia Apache versión 2.0
([LICENSE-APACHE](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-APACHE) o
[http://www.apache.org/licenses/LICENSE-2.0]).
* Licencia MIT
([LICENSE-MIT](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-MIT) o
[http://opensource.org/licenses/MIT]).

View file

@ -0,0 +1,5 @@
e404-description = Oops! Page Not Found
e404-message = The page you are looking for may have been removed, had its name changed, or is temporarily unavailable.
e500-description = Oops! Unexpected Error
e500-message = We're having an issue. Please report this error to an administrator.
back-homepage = Back to homepage

View file

@ -0,0 +1,5 @@
e404-description = ¡Vaya! Página No Encontrada
e404-message = La página que está buscando puede haber sido eliminada, cambiada de nombre o no está disponible temporalmente.
e500-description = ¡Vaya! Error Inesperado
e500-message = Está ocurriendo una incidencia. Por favor, informe de este error a un administrador.
back-homepage = Volver al inicio

View file

@ -0,0 +1,71 @@
use pagetop::prelude::*;
pub_handle!(THEME_BOOTSIER);
pub_locale!("locales");
include!(concat!(env!("OUT_DIR"), "/bootsier.rs"));
pub struct Bootsier;
impl ModuleTrait for Bootsier {
fn handle(&self) -> Handle {
THEME_BOOTSIER
}
fn theme(&self) -> Option<ThemeStaticRef> {
Some(&Bootsier)
}
fn dependencies(&self) -> Vec<ModuleStaticRef> {
vec![&pagetop_jquery::JQuery]
}
fn configure_service(&self, cfg: &mut server::web::ServiceConfig) {
serve_static_files!(cfg, "/bootsier", bundle_bootsier);
}
}
impl ThemeTrait for Bootsier {
fn before_render_page(&self, page: &mut Page) {
page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico")))
.alter_context(ContextOp::AddStyleSheet(
StyleSheet::located("/bootsier/css/bootstrap.min.css")
.with_version("5.1.3")
.with_weight(-99),
))
.alter_context(ContextOp::AddJavaScript(
JavaScript::located("/bootsier/js/bootstrap.bundle.min.js")
.with_version("5.1.3")
.with_weight(-99),
));
pagetop_jquery::JQuery::add_jquery(page.context());
}
fn error_404_not_found(&self) -> Container {
Container::new().with_component(Html::with(html! {
div class="jumbotron" {
div class="media" {
img
src="/bootsier/images/caution.png"
class="mr-4"
style="width: 20%; max-width: 188px"
alt="Caution!";
div class="media-body" {
h1 class="display-4" { ("RESOURCE NOT FOUND") }
p class="lead" { (l("e404-description")) }
hr class="my-4";
p { (l("e404-description")) }
a
class="btn btn-primary btn-lg"
href="/"
role="button"
{
(l("back-homepage"))
}
}
}
}
}))
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long