`prepare()` de `Component`, `render()` de `Region` y `Template`, y la implementación de `ComponentRender` pasan a ser funciones async. Se actualizan todos los componentes base, helpers, tests y ejemplos.
32 lines
924 B
Rust
32 lines
924 B
Rust
/// Es el tema básico que incluye PageTop por defecto.
|
|
use crate::prelude::*;
|
|
|
|
/// Tema básico por defecto que extiende el funcionamiento predeterminado de [`Theme`].
|
|
pub struct Basic;
|
|
|
|
#[async_trait]
|
|
impl Extension for Basic {
|
|
fn theme(&self) -> Option<ThemeRef> {
|
|
Some(&Self)
|
|
}
|
|
}
|
|
|
|
#[async_trait]
|
|
impl Theme for Basic {
|
|
fn before_render_page_body(&self, page: &mut Page) {
|
|
page.alter_assets(AssetsOp::AddStyleSheet(
|
|
StyleSheet::from("/pagetop/css/normalize.css")
|
|
.with_version("8.0.1")
|
|
.with_weight(-99),
|
|
))
|
|
.alter_assets(AssetsOp::AddStyleSheet(
|
|
StyleSheet::from("/pagetop/css/basic.css")
|
|
.with_version(PAGETOP_VERSION)
|
|
.with_weight(-99),
|
|
))
|
|
.alter_child_in(
|
|
&DefaultRegion::Footer,
|
|
ChildOp::AddIfEmpty(PoweredBy::new().into()),
|
|
);
|
|
}
|
|
}
|