✨ Permite a plantillas cambiar atributos de <body>
This commit is contained in:
parent
d495c05b96
commit
26f1cda831
2 changed files with 30 additions and 15 deletions
|
|
@ -89,7 +89,6 @@ pub struct Page {
|
|||
description : Attr<L10n>,
|
||||
metadata : Vec<(&'static str, &'static str)>,
|
||||
properties : Vec<(&'static str, &'static str)>,
|
||||
body_props : Props,
|
||||
context : Context,
|
||||
}
|
||||
|
||||
|
|
@ -105,7 +104,6 @@ impl Page {
|
|||
description : Attr::<L10n>::default(),
|
||||
metadata : Vec::default(),
|
||||
properties : Vec::default(),
|
||||
body_props : Props::default(),
|
||||
context : Context::new(Some(request)),
|
||||
}
|
||||
}
|
||||
|
|
@ -140,13 +138,6 @@ impl Page {
|
|||
self
|
||||
}
|
||||
|
||||
/// Modifica identificador, clases CSS o atributos HTML del elemento `<body>`.
|
||||
#[builder_fn]
|
||||
pub fn with_body_props(mut self, op: PropsOp) -> Self {
|
||||
self.body_props.alter_prop(op);
|
||||
self
|
||||
}
|
||||
|
||||
// **< Page GETTERS >***************************************************************************
|
||||
|
||||
/// Devuelve el título traducido para el idioma de la página, si existe.
|
||||
|
|
@ -169,11 +160,6 @@ impl Page {
|
|||
&self.properties
|
||||
}
|
||||
|
||||
/// Devuelve identificador, clases CSS y atributos HTML del elemento `<body>`.
|
||||
pub fn body_props(&self) -> &Props {
|
||||
&self.body_props
|
||||
}
|
||||
|
||||
/// Devuelve una referencia mutable al [`Context`] de la página.
|
||||
///
|
||||
/// El [`Context`] actúa como intermediario para muchos métodos de `Page` (idioma, tema,
|
||||
|
|
@ -305,6 +291,12 @@ impl Contextual for Page {
|
|||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
fn with_body_props(mut self, op: PropsOp) -> Self {
|
||||
self.context.alter_body_props(op);
|
||||
self
|
||||
}
|
||||
|
||||
#[builder_fn]
|
||||
fn with_child(mut self, op: impl Into<ChildOp>) -> Self {
|
||||
self.context
|
||||
|
|
@ -348,6 +340,10 @@ impl Contextual for Page {
|
|||
self.context.javascripts()
|
||||
}
|
||||
|
||||
fn body_props(&self) -> &Props {
|
||||
self.context.body_props()
|
||||
}
|
||||
|
||||
// **< Contextual HELPERS >*********************************************************************
|
||||
|
||||
fn remove_param(&mut self, key: &'static str) -> bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue