🚚 Restore macro name #[fn_builder] for fn_with

This commit is contained in:
Manuel Cillero 2024-02-28 09:08:50 +01:00
parent 2389aad546
commit a9a5d232a2
36 changed files with 190 additions and 187 deletions

View file

@ -7,6 +7,7 @@ use crate::base::action;
use crate::core::component::{AnyComponents, ArcAnyComponent, ComponentTrait};
use crate::core::component::{Context, ContextOp};
use crate::core::theme::ComponentsInRegions;
use crate::fn_builder;
use crate::html::{html, Markup, DOCTYPE};
use crate::html::{ClassesOp, Favicon, OptionClasses, OptionId, OptionTranslated};
use crate::locale::L10n;
@ -49,68 +50,68 @@ impl Page {
// Page BUILDER.
#[fn_with]
#[fn_builder]
pub fn alter_title(&mut self, title: L10n) -> &mut Self {
self.title.alter_value(title);
self
}
#[fn_with]
#[fn_builder]
pub fn alter_description(&mut self, description: L10n) -> &mut Self {
self.description.alter_value(description);
self
}
#[fn_with]
#[fn_builder]
pub fn alter_metadata(&mut self, name: &'static str, content: &'static str) -> &mut Self {
self.metadata.push((name, content));
self
}
#[fn_with]
#[fn_builder]
pub fn alter_property(&mut self, property: &'static str, content: &'static str) -> &mut Self {
self.metadata.push((property, content));
self
}
#[fn_with]
#[fn_builder]
pub fn alter_favicon(&mut self, favicon: Option<Favicon>) -> &mut Self {
self.favicon = favicon;
self
}
#[fn_with]
#[fn_builder]
pub fn alter_context(&mut self, op: ContextOp) -> &mut Self {
self.context.alter(op);
self
}
#[fn_with]
#[fn_builder]
pub fn alter_body_id(&mut self, id: impl Into<String>) -> &mut Self {
self.body_id.alter_value(id);
self
}
#[fn_with]
#[fn_builder]
pub fn alter_body_classes(&mut self, op: ClassesOp, classes: impl Into<String>) -> &mut Self {
self.body_classes.alter_value(op, classes);
self
}
#[fn_with]
#[fn_builder]
pub fn alter_skip_to(&mut self, id: impl Into<String>) -> &mut Self {
self.skip_to.alter_value(id);
self
}
#[fn_with]
#[fn_builder]
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
self.regions
.add_component_in("content", ArcAnyComponent::new(component));
self
}
#[fn_with]
#[fn_builder]
pub fn alter_component_in(
&mut self,
region: &'static str,
@ -121,7 +122,7 @@ impl Page {
self
}
#[fn_with]
#[fn_builder]
pub fn alter_template(&mut self, template: &str) -> &mut Self {
self.template = template.to_owned();
self