Modifica orden de parámetros que modifica clases

This commit is contained in:
Manuel Cillero 2022-07-14 07:21:57 +02:00
parent 4b3fc94574
commit c593fc5801
22 changed files with 153 additions and 155 deletions

View file

@ -36,5 +36,5 @@ impl ModuleTrait for Admin {
}
fn before_render_page(page: &mut Page) {
page.alter_body_classes("test-admin", ClassesOp::Add);
page.alter_body_classes(ClassesOp::Add, "test-admin");
}

View file

@ -51,5 +51,5 @@ async fn node() -> app::Result<Markup> {
}
fn before_render_page(page: &mut Page) {
page.alter_body_classes("test-node", ClassesOp::Add);
page.alter_body_classes(ClassesOp::Add, "test-node");
}

View file

@ -125,8 +125,8 @@ impl Anchor {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -187,8 +187,8 @@ impl Anchor {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}
@ -199,10 +199,10 @@ impl Anchor {
pub fn alter_type(&mut self, anchor_type: AnchorType) -> &mut Self {
self.anchor_type = anchor_type;
self.classes.alter(match self.anchor_type {
self.classes.alter(ClassesOp::SetDefault, match self.anchor_type {
AnchorType::Button => "btn btn-primary",
_ => "",
}, ClassesOp::SetDefault);
});
self
}

View file

@ -80,8 +80,8 @@ impl Block {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -117,8 +117,8 @@ impl Block {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -90,25 +90,25 @@ impl ComponentTrait for Container {
impl Container {
pub fn header() -> Self {
let mut c = Container::new().with_classes("header", ClassesOp::SetDefault);
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "header");
c.container_type = ContainerType::Header;
c
}
pub fn footer() -> Self {
let mut c = Container::new().with_classes("footer", ClassesOp::SetDefault);
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "footer");
c.container_type = ContainerType::Footer;
c
}
pub fn main() -> Self {
let mut c = Container::new().with_classes("main", ClassesOp::SetDefault);
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "main");
c.container_type = ContainerType::Main;
c
}
pub fn section() -> Self {
let mut c = Container::new().with_classes("section", ClassesOp::SetDefault);
let mut c = Container::new().with_classes(ClassesOp::SetDefault, "section");
c.container_type = ContainerType::Section;
c
}
@ -130,13 +130,13 @@ impl Container {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
pub fn with_inner_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_inner_classes(classes, op);
pub fn with_inner_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_inner_classes(op, classes);
self
}
@ -167,13 +167,13 @@ impl Container {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}
pub fn alter_inner_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.inner_classes.alter(classes, op);
pub fn alter_inner_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.inner_classes.alter(op, classes);
self
}

View file

@ -29,7 +29,7 @@ impl ComponentTrait for Button {
disabled : AttributeValue::new(),
template : "default".to_owned(),
}
.with_classes("form-button", ClassesOp::AddFirst)
.with_classes(ClassesOp::AddFirst, "form-button")
}
fn handler(&self) -> &'static str {
@ -88,7 +88,7 @@ impl Button {
pub fn reset(value: &str) -> Self {
let mut button = Button::new()
.with_classes("form-reset", ClassesOp::Replace("form-button"))
.with_classes(ClassesOp::Replace("form-button"), "form-reset")
.with_value(value);
button.button_type = ButtonType::Reset;
button
@ -96,7 +96,7 @@ impl Button {
pub fn submit(value: &str) -> Self {
let mut button = Button::new()
.with_classes("form-submit", ClassesOp::Replace("form-button"))
.with_classes(ClassesOp::Replace("form-button"), "form-submit")
.with_value(value);
button.button_type = ButtonType::Submit;
button
@ -114,8 +114,8 @@ impl Button {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -156,8 +156,8 @@ impl Button {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -37,7 +37,7 @@ impl ComponentTrait for Date {
help_text : AttributeValue::new(),
template : "default".to_owned(),
}
.with_classes("form-type-date", ClassesOp::AddFirst)
.with_classes(ClassesOp::AddFirst, "form-type-date")
}
fn handler(&self) -> &'static str {
@ -114,8 +114,8 @@ impl Date {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -186,8 +186,8 @@ impl Date {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -89,8 +89,8 @@ impl Form {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -136,8 +136,8 @@ impl Form {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -47,7 +47,7 @@ impl ComponentTrait for Input {
help_text : AttributeValue::new(),
template : "default".to_owned(),
}
.with_classes("form-type-textfield", ClassesOp::AddFirst)
.with_classes(ClassesOp::AddFirst, "form-type-textfield")
}
fn handler(&self) -> &'static str {
@ -128,35 +128,35 @@ impl Input {
pub fn password() -> Self {
let mut input = Input::new()
.with_classes("form-type-password", ClassesOp::Replace("form-type-textfield"));
.with_classes(ClassesOp::Replace("form-type-textfield"), "form-type-password");
input.input_type = InputType::Password;
input
}
pub fn search() -> Self {
let mut input = Input::new()
.with_classes("form-type-search", ClassesOp::Replace("form-type-textfield"));
.with_classes(ClassesOp::Replace("form-type-textfield"), "form-type-search");
input.input_type = InputType::Search;
input
}
pub fn email() -> Self {
let mut input = Input::new()
.with_classes("form-type-email", ClassesOp::Replace("form-type-textfield"));
.with_classes(ClassesOp::Replace("form-type-textfield"), "form-type-email");
input.input_type = InputType::Email;
input
}
pub fn telephone() -> Self {
let mut input = Input::new()
.with_classes("form-type-telephone", ClassesOp::Replace("form-type-textfield"));
.with_classes(ClassesOp::Replace("form-type-textfield"), "form-type-telephone");
input.input_type = InputType::Telephone;
input
}
pub fn url() -> Self {
let mut input = Input::new()
.with_classes("form-type-url", ClassesOp::Replace("form-type-textfield"));
.with_classes(ClassesOp::Replace("form-type-textfield"), "form-type-url");
input.input_type = InputType::Url;
input
}
@ -173,8 +173,8 @@ impl Input {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -260,16 +260,15 @@ impl Input {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}
pub fn alter_name(&mut self, name: &str) -> &mut Self {
self.name.with_value(name);
self.alter_classes(
concat_string!("form-item form-item-", name).as_str(),
ClassesOp::SetDefault
self.alter_classes(ClassesOp::SetDefault,
concat_string!("form-item form-item-", name).as_str()
);
self
}

View file

@ -56,19 +56,19 @@ impl ComponentTrait for Column {
fn before_render(&mut self, _context: &mut InContext) {
match self.size() {
ColumnSize::Default => self.alter_classes("col-sm", ClassesOp::SetDefault),
ColumnSize::Is1of12 => self.alter_classes("col-sm-1", ClassesOp::SetDefault),
ColumnSize::Is2of12 => self.alter_classes("col-sm-2", ClassesOp::SetDefault),
ColumnSize::Is3of12 => self.alter_classes("col-sm-3", ClassesOp::SetDefault),
ColumnSize::Is4of12 => self.alter_classes("col-sm-4", ClassesOp::SetDefault),
ColumnSize::Is5of12 => self.alter_classes("col-sm-5", ClassesOp::SetDefault),
ColumnSize::Is6of12 => self.alter_classes("col-sm-6", ClassesOp::SetDefault),
ColumnSize::Is7of12 => self.alter_classes("col-sm-7", ClassesOp::SetDefault),
ColumnSize::Is8of12 => self.alter_classes("col-sm-8", ClassesOp::SetDefault),
ColumnSize::Is9of12 => self.alter_classes("col-sm-9", ClassesOp::SetDefault),
ColumnSize::Is10of12 => self.alter_classes("col-sm-10", ClassesOp::SetDefault),
ColumnSize::Is11of12 => self.alter_classes("col-sm-11", ClassesOp::SetDefault),
ColumnSize::IsFull => self.alter_classes("col-sm-12", ClassesOp::SetDefault),
ColumnSize::Default => self.alter_classes(ClassesOp::SetDefault, "col-md"),
ColumnSize::Is1of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-1"),
ColumnSize::Is2of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-2"),
ColumnSize::Is3of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-3"),
ColumnSize::Is4of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-4"),
ColumnSize::Is5of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-5"),
ColumnSize::Is6of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-6"),
ColumnSize::Is7of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-7"),
ColumnSize::Is8of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-8"),
ColumnSize::Is9of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-9"),
ColumnSize::Is10of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-10"),
ColumnSize::Is11of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-11"),
ColumnSize::IsFull => self.alter_classes(ClassesOp::SetDefault, "col-md-12"),
};
}
@ -108,8 +108,8 @@ impl Column {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -150,8 +150,8 @@ impl Column {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -73,8 +73,8 @@ impl Row {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -110,8 +110,8 @@ impl Row {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -115,8 +115,8 @@ impl Heading {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -157,8 +157,8 @@ impl Heading {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}
@ -174,7 +174,7 @@ impl Heading {
pub fn alter_display(&mut self, display: HeadingDisplay) -> &mut Self {
self.display = display;
self.classes.alter(match &self.display() {
self.classes.alter(ClassesOp::SetDefault, match &self.display() {
HeadingDisplay::XxLarge => "display-2",
HeadingDisplay::Large => "display-3",
HeadingDisplay::Medium => "display-4",
@ -182,7 +182,7 @@ impl Heading {
HeadingDisplay::XxSmall => "display-6",
HeadingDisplay::Normal => "",
HeadingDisplay::Subtitle => "",
}, ClassesOp::SetDefault);
});
self
}

View file

@ -40,7 +40,7 @@ impl ComponentTrait for Icon {
.with_version("1.8.2")
));
self.alter_classes(concat_string!("bi-", self.icon_name()).as_str(), ClassesOp::SetDefault);
self.alter_classes(ClassesOp::SetDefault, concat_string!("bi-", self.icon_name()).as_str());
}
fn default_render(&self, _context: &mut InContext) -> Markup {
@ -78,8 +78,8 @@ impl Icon {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -105,8 +105,8 @@ impl Icon {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -75,8 +75,8 @@ impl Image {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -107,8 +107,8 @@ impl Image {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -266,8 +266,8 @@ impl Menu {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -298,8 +298,8 @@ impl Menu {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}

View file

@ -83,8 +83,8 @@ impl Paragraph {
self
}
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
self.alter_classes(classes, op);
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
self.alter_classes(op, classes);
self
}
@ -120,8 +120,8 @@ impl Paragraph {
self
}
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.classes.alter(classes, op);
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.classes.alter(op, classes);
self
}
@ -132,14 +132,14 @@ impl Paragraph {
pub fn alter_display(&mut self, display: ParagraphDisplay) -> &mut Self {
self.display = display;
self.classes.alter(match &self.display() {
self.classes.alter(ClassesOp::SetDefault, match &self.display() {
ParagraphDisplay::XxLarge => "fs-2",
ParagraphDisplay::Large => "fs-3",
ParagraphDisplay::Medium => "fs-4",
ParagraphDisplay::Small => "fs-5",
ParagraphDisplay::XxSmall => "fs-6",
ParagraphDisplay::Normal => "",
}, ClassesOp::SetDefault);
});
self
}

View file

@ -28,7 +28,7 @@ async fn demo() -> app::Result<Markup> {
Page::new()
.with_title(l("page_title").as_str())
.add_to("content", hello_world())
.add_to("content", just_visiting())
.add_to("content", welcome())
.add_to("content", about_pagetop())
.add_to("content", promo_pagetop())
.add_to("content", reporting_problems())
@ -39,10 +39,16 @@ fn hello_world() -> Container {
Container::header()
.with_id("hello-world")
.with_component(grid::Row::new()
.with_layout(
&[LayoutSet::PaddingSide(UnitValue::RelEm(2.0), UnitValue::RelPct(5.0))]
)
.with_layout(&[
LayoutSet::PaddingTop(UnitValue::RelEm(2.0)),
LayoutSet::PaddingBottom(UnitValue::RelEm(2.0)),
LayoutSet::PaddingLeft(UnitValue::RelPct(2.0)),
])
.with_column(grid::Column::new()
.with_layout(&[
LayoutSet::PaddingTop(UnitValue::RelEm(2.0)),
LayoutSet::PaddingBottom(UnitValue::RelEm(2.0)),
])
.with_size(grid::ColumnSize::Is4of12)
.with_component(Heading::h1(html! {
(l("page_title"))
@ -50,18 +56,14 @@ fn hello_world() -> Container {
.with_display(HeadingDisplay::Medium)
)
.with_component(Paragraph::with(html! {
(t("welcome_to", &args!["app" => SETTINGS.app.name.as_str()]))
})
)
.with_component(Paragraph::with(html! {
(e("welcome_intro", &args![
(e("hello_intro", &args![
"app" => format!("<strong>{}</strong>", &SETTINGS.app.name)
]))
})
.with_display(ParagraphDisplay::Small)
)
.with_component(Paragraph::with(html! {
(e("welcome_pagetop", &args![
(e("hello_pagetop", &args![
"pagetop" => "<a href=\"https://pagetop-rs\">PageTop</a>"
]))
})
@ -87,13 +89,13 @@ fn hello_world() -> Container {
)
}
fn just_visiting() -> Container {
fn welcome() -> Container {
Container::new()
.with_id("visiting")
.with_component(grid::Row::new()
.with_layout(
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
)
.with_layout(&[
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
])
.with_column(grid::Column::new()
.with_layout(&[LayoutSet::PaddingAll(UnitValue::RelPct(2.0))])
.with_size(grid::ColumnSize::Is5of12)
@ -105,20 +107,19 @@ fn just_visiting() -> Container {
LayoutSet::PaddingLeft(UnitValue::RelPct(5.0)),
])
.with_component(Heading::h2(html! {
(l("visiting_title"))
})
)
(t("welcome_to", &args!["app" => SETTINGS.app.name.as_str()]))
}))
.with_component(Heading::h3(html! {
(l("visiting_subtitle"))
(l("welcome_subtitle"))
})
.with_display(HeadingDisplay::Subtitle)
)
.with_component(Paragraph::with(html! {
(l("visiting_text1"))
(l("welcome_text1"))
})
.with_display(ParagraphDisplay::Small)
)
.with_component(Paragraph::with(html! { (l("visiting_text2")) }))
.with_component(Paragraph::with(html! { (l("welcome_text2")) }))
)
)
}
@ -127,9 +128,9 @@ fn about_pagetop() -> Container {
Container::new()
.with_id("pagetop")
.with_component(grid::Row::new()
.with_layout(
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
)
.with_layout(&[
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
])
.with_column(grid::Column::new()
.with_layout(&[
LayoutSet::PaddingTop(UnitValue::RelPct(2.5)),
@ -165,9 +166,9 @@ fn promo_pagetop() -> Container {
Container::new()
.with_id("promo")
.with_component(grid::Row::new()
.with_layout(
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
)
.with_layout(&[
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
])
.with_column(grid::Column::new()
.with_layout(&[LayoutSet::PaddingAll(UnitValue::RelPct(2.0))])
.with_size(grid::ColumnSize::Is5of12)
@ -197,9 +198,9 @@ fn reporting_problems() -> Container {
Container::new()
.with_id("reporting")
.with_component(grid::Row::new()
.with_layout(
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
)
.with_layout(&[
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
])
.with_column(grid::Column::new()
.with_layout(&[
LayoutSet::PaddingTop(UnitValue::RelPct(2.5)),

View file

@ -3,14 +3,13 @@ module_description = Displays a demo homepage when none is configured.
page_title = Hello world!
welcome_to = Welcome to { $app }
welcome_intro = This page is used to test the proper operation of { $app } after installation.
welcome_pagetop = This web solution is powered by { $pagetop }.
hello_intro = This page is used to test the proper operation of { $app } after installation.
hello_pagetop = This web solution is powered by { $pagetop }.
visiting_title = Just visiting?
visiting_subtitle = Are you user of this website?
visiting_text1 = If you don't know what this page is about, this probably means that the site is either experiencing problems or is undergoing routine maintenance.
visiting_text2 = If the problem persists, please contact your system administrator.
welcome_to = Welcome to { $app }
welcome_subtitle = Are you user of this website?
welcome_text1 = If you don't know what this page is about, this probably means that the site is either experiencing problems or is undergoing routine maintenance.
welcome_text2 = If the problem persists, please contact your system administrator.
pagetop_title = About PageTop
pagetop_text1 = If you can read this page, it means that the PageTop server is working properly, but has not yet been configured.

View file

@ -3,14 +3,13 @@ module_description = Muestra una página de demostración predeterminada cuando
page_title = ¡Hola mundo!
welcome_to = Bienvenido a { $app }
welcome_intro = Esta página se utiliza para probar el correcto funcionamiento de { $app } después de la instalación.
welcome_pagetop = Esta solución web funciona con { $pagetop }.
hello_intro = Esta página se utiliza para probar el correcto funcionamiento de { $app } después de la instalación.
hello_pagetop = Esta solución web funciona con { $pagetop }.
visiting_title = ¿Sólo de visita?
visiting_subtitle = ¿Eres usuario de este sitio web?
visiting_text1 = Si no sabes de qué trata esta página, probablemente significa que el sitio está experimentando problemas o está pasando por un mantenimiento de rutina.
visiting_text2 = Si el problema persiste, póngase en contacto con el administrador del sistema.
welcome_to = Bienvenido a { $app }
welcome_subtitle = ¿Eres usuario de este sitio web?
welcome_text1 = Si no sabes de qué trata esta página, probablemente significa que el sitio está experimentando problemas o está pasando por un mantenimiento de rutina.
welcome_text2 = Si el problema persiste, póngase en contacto con el administrador del sistema.
pagetop_title = Sobre PageTop
pagetop_text1 = Si puedes leer esta página, significa que el servidor PageTop funciona correctamente, pero aún no se ha configurado.

View file

@ -36,14 +36,14 @@ impl ThemeTrait for Bulmix {
match component.handler() {
ANCHOR_COMPONENT => {
let a = component_mut::<Anchor>(component);
a.alter_classes(match a.anchor_type() {
a.alter_classes(ClassesOp::SetDefault, match a.anchor_type() {
AnchorType::Button => "button is-primary",
_ => "",
}, ClassesOp::SetDefault);
});
},
HEADING_COMPONENT => {
let h = component_mut::<Heading>(component);
h.alter_classes(match h.display() {
h.alter_classes(ClassesOp::SetDefault, match h.display() {
HeadingDisplay::XxLarge => "title is-1",
HeadingDisplay::Large => "title is-2",
HeadingDisplay::Medium => "title is-3",
@ -51,22 +51,22 @@ impl ThemeTrait for Bulmix {
HeadingDisplay::XxSmall => "title is-5",
HeadingDisplay::Normal => "title",
HeadingDisplay::Subtitle => "subtitle",
}, ClassesOp::SetDefault);
});
},
PARAGRAPH_COMPONENT => {
let p = component_mut::<Paragraph>(component);
p.alter_classes(match p.display() {
p.alter_classes(ClassesOp::SetDefault, match p.display() {
ParagraphDisplay::XxLarge => "is-size-2",
ParagraphDisplay::Large => "is-size-3",
ParagraphDisplay::Medium => "is-size-4",
ParagraphDisplay::Small => "is-size-5",
ParagraphDisplay::XxSmall => "is-size-6",
ParagraphDisplay::Normal => "",
}, ClassesOp::SetDefault);
});
},
grid::COLUMN_COMPONENT => {
let col = component_mut::<grid::Column>(component);
col.alter_classes(concat_string!("column", match col.size() {
col.alter_classes(ClassesOp::SetDefault, concat_string!("column", match col.size() {
grid::ColumnSize::Default => "",
grid::ColumnSize::Is1of12 => " is-1",
grid::ColumnSize::Is2of12 => " is-2",
@ -80,11 +80,11 @@ impl ThemeTrait for Bulmix {
grid::ColumnSize::Is10of12 => " is-10",
grid::ColumnSize::Is11of12 => " is-11",
grid::ColumnSize::IsFull => " is-12",
}, " content").as_str(), ClassesOp::SetDefault);
}, " content").as_str());
},
grid::ROW_COMPONENT => {
let row = component_mut::<grid::Row>(component);
row.alter_classes("columns", ClassesOp::SetDefault);
row.alter_classes(ClassesOp::SetDefault, "columns");
},
_ => {},
}

View file

@ -29,11 +29,11 @@ impl Classes {
pub fn new_with_default(default: &str) -> Self {
let mut classes = Self::new();
classes.alter(default, ClassesOp::SetDefault);
classes.alter(ClassesOp::SetDefault, default);
classes
}
pub fn alter(&mut self, classes: &str, op: ClassesOp) -> &Self {
pub fn alter(&mut self, op: ClassesOp, classes: &str) -> &Self {
let classes = classes.trim();
match op {
ClassesOp::Add => {

View file

@ -107,8 +107,8 @@ impl<'a> Page<'a> {
self
}
pub fn alter_body_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
self.body_classes.alter(classes, op);
pub fn alter_body_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
self.body_classes.alter(op, classes);
self
}