Modifica orden de parámetros que modifica clases
This commit is contained in:
parent
4b3fc94574
commit
c593fc5801
22 changed files with 153 additions and 155 deletions
|
|
@ -36,5 +36,5 @@ impl ModuleTrait for Admin {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_render_page(page: &mut Page) {
|
fn before_render_page(page: &mut Page) {
|
||||||
page.alter_body_classes("test-admin", ClassesOp::Add);
|
page.alter_body_classes(ClassesOp::Add, "test-admin");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,5 +51,5 @@ async fn node() -> app::Result<Markup> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_render_page(page: &mut Page) {
|
fn before_render_page(page: &mut Page) {
|
||||||
page.alter_body_classes("test-node", ClassesOp::Add);
|
page.alter_body_classes(ClassesOp::Add, "test-node");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,8 @@ impl Anchor {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,8 +187,8 @@ impl Anchor {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,10 +199,10 @@ impl Anchor {
|
||||||
|
|
||||||
pub fn alter_type(&mut self, anchor_type: AnchorType) -> &mut Self {
|
pub fn alter_type(&mut self, anchor_type: AnchorType) -> &mut Self {
|
||||||
self.anchor_type = anchor_type;
|
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",
|
AnchorType::Button => "btn btn-primary",
|
||||||
_ => "",
|
_ => "",
|
||||||
}, ClassesOp::SetDefault);
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,8 @@ impl Block {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,8 +117,8 @@ impl Block {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,25 +90,25 @@ impl ComponentTrait for Container {
|
||||||
|
|
||||||
impl Container {
|
impl Container {
|
||||||
pub fn header() -> Self {
|
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.container_type = ContainerType::Header;
|
||||||
c
|
c
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn footer() -> Self {
|
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.container_type = ContainerType::Footer;
|
||||||
c
|
c
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() -> Self {
|
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.container_type = ContainerType::Main;
|
||||||
c
|
c
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn section() -> Self {
|
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.container_type = ContainerType::Section;
|
||||||
c
|
c
|
||||||
}
|
}
|
||||||
|
|
@ -130,13 +130,13 @@ impl Container {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_inner_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_inner_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_inner_classes(classes, op);
|
self.alter_inner_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,13 +167,13 @@ impl Container {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_inner_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_inner_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.inner_classes.alter(classes, op);
|
self.inner_classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ impl ComponentTrait for Button {
|
||||||
disabled : AttributeValue::new(),
|
disabled : AttributeValue::new(),
|
||||||
template : "default".to_owned(),
|
template : "default".to_owned(),
|
||||||
}
|
}
|
||||||
.with_classes("form-button", ClassesOp::AddFirst)
|
.with_classes(ClassesOp::AddFirst, "form-button")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handler(&self) -> &'static str {
|
fn handler(&self) -> &'static str {
|
||||||
|
|
@ -88,7 +88,7 @@ impl Button {
|
||||||
|
|
||||||
pub fn reset(value: &str) -> Self {
|
pub fn reset(value: &str) -> Self {
|
||||||
let mut button = Button::new()
|
let mut button = Button::new()
|
||||||
.with_classes("form-reset", ClassesOp::Replace("form-button"))
|
.with_classes(ClassesOp::Replace("form-button"), "form-reset")
|
||||||
.with_value(value);
|
.with_value(value);
|
||||||
button.button_type = ButtonType::Reset;
|
button.button_type = ButtonType::Reset;
|
||||||
button
|
button
|
||||||
|
|
@ -96,7 +96,7 @@ impl Button {
|
||||||
|
|
||||||
pub fn submit(value: &str) -> Self {
|
pub fn submit(value: &str) -> Self {
|
||||||
let mut button = Button::new()
|
let mut button = Button::new()
|
||||||
.with_classes("form-submit", ClassesOp::Replace("form-button"))
|
.with_classes(ClassesOp::Replace("form-button"), "form-submit")
|
||||||
.with_value(value);
|
.with_value(value);
|
||||||
button.button_type = ButtonType::Submit;
|
button.button_type = ButtonType::Submit;
|
||||||
button
|
button
|
||||||
|
|
@ -114,8 +114,8 @@ impl Button {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,8 +156,8 @@ impl Button {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ impl ComponentTrait for Date {
|
||||||
help_text : AttributeValue::new(),
|
help_text : AttributeValue::new(),
|
||||||
template : "default".to_owned(),
|
template : "default".to_owned(),
|
||||||
}
|
}
|
||||||
.with_classes("form-type-date", ClassesOp::AddFirst)
|
.with_classes(ClassesOp::AddFirst, "form-type-date")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handler(&self) -> &'static str {
|
fn handler(&self) -> &'static str {
|
||||||
|
|
@ -114,8 +114,8 @@ impl Date {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,8 +186,8 @@ impl Date {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ impl Form {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,8 +136,8 @@ impl Form {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ impl ComponentTrait for Input {
|
||||||
help_text : AttributeValue::new(),
|
help_text : AttributeValue::new(),
|
||||||
template : "default".to_owned(),
|
template : "default".to_owned(),
|
||||||
}
|
}
|
||||||
.with_classes("form-type-textfield", ClassesOp::AddFirst)
|
.with_classes(ClassesOp::AddFirst, "form-type-textfield")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handler(&self) -> &'static str {
|
fn handler(&self) -> &'static str {
|
||||||
|
|
@ -128,35 +128,35 @@ impl Input {
|
||||||
|
|
||||||
pub fn password() -> Self {
|
pub fn password() -> Self {
|
||||||
let mut input = Input::new()
|
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.input_type = InputType::Password;
|
||||||
input
|
input
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn search() -> Self {
|
pub fn search() -> Self {
|
||||||
let mut input = Input::new()
|
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.input_type = InputType::Search;
|
||||||
input
|
input
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn email() -> Self {
|
pub fn email() -> Self {
|
||||||
let mut input = Input::new()
|
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.input_type = InputType::Email;
|
||||||
input
|
input
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn telephone() -> Self {
|
pub fn telephone() -> Self {
|
||||||
let mut input = Input::new()
|
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.input_type = InputType::Telephone;
|
||||||
input
|
input
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn url() -> Self {
|
pub fn url() -> Self {
|
||||||
let mut input = Input::new()
|
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.input_type = InputType::Url;
|
||||||
input
|
input
|
||||||
}
|
}
|
||||||
|
|
@ -173,8 +173,8 @@ impl Input {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,16 +260,15 @@ impl Input {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
pub fn alter_name(&mut self, name: &str) -> &mut Self {
|
||||||
self.name.with_value(name);
|
self.name.with_value(name);
|
||||||
self.alter_classes(
|
self.alter_classes(ClassesOp::SetDefault,
|
||||||
concat_string!("form-item form-item-", name).as_str(),
|
concat_string!("form-item form-item-", name).as_str()
|
||||||
ClassesOp::SetDefault
|
|
||||||
);
|
);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,19 +56,19 @@ impl ComponentTrait for Column {
|
||||||
|
|
||||||
fn before_render(&mut self, _context: &mut InContext) {
|
fn before_render(&mut self, _context: &mut InContext) {
|
||||||
match self.size() {
|
match self.size() {
|
||||||
ColumnSize::Default => self.alter_classes("col-sm", ClassesOp::SetDefault),
|
ColumnSize::Default => self.alter_classes(ClassesOp::SetDefault, "col-md"),
|
||||||
ColumnSize::Is1of12 => self.alter_classes("col-sm-1", ClassesOp::SetDefault),
|
ColumnSize::Is1of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-1"),
|
||||||
ColumnSize::Is2of12 => self.alter_classes("col-sm-2", ClassesOp::SetDefault),
|
ColumnSize::Is2of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-2"),
|
||||||
ColumnSize::Is3of12 => self.alter_classes("col-sm-3", ClassesOp::SetDefault),
|
ColumnSize::Is3of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-3"),
|
||||||
ColumnSize::Is4of12 => self.alter_classes("col-sm-4", ClassesOp::SetDefault),
|
ColumnSize::Is4of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-4"),
|
||||||
ColumnSize::Is5of12 => self.alter_classes("col-sm-5", ClassesOp::SetDefault),
|
ColumnSize::Is5of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-5"),
|
||||||
ColumnSize::Is6of12 => self.alter_classes("col-sm-6", ClassesOp::SetDefault),
|
ColumnSize::Is6of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-6"),
|
||||||
ColumnSize::Is7of12 => self.alter_classes("col-sm-7", ClassesOp::SetDefault),
|
ColumnSize::Is7of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-7"),
|
||||||
ColumnSize::Is8of12 => self.alter_classes("col-sm-8", ClassesOp::SetDefault),
|
ColumnSize::Is8of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-8"),
|
||||||
ColumnSize::Is9of12 => self.alter_classes("col-sm-9", ClassesOp::SetDefault),
|
ColumnSize::Is9of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-9"),
|
||||||
ColumnSize::Is10of12 => self.alter_classes("col-sm-10", ClassesOp::SetDefault),
|
ColumnSize::Is10of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-10"),
|
||||||
ColumnSize::Is11of12 => self.alter_classes("col-sm-11", ClassesOp::SetDefault),
|
ColumnSize::Is11of12 => self.alter_classes(ClassesOp::SetDefault, "col-md-11"),
|
||||||
ColumnSize::IsFull => self.alter_classes("col-sm-12", ClassesOp::SetDefault),
|
ColumnSize::IsFull => self.alter_classes(ClassesOp::SetDefault, "col-md-12"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,8 +108,8 @@ impl Column {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,8 +150,8 @@ impl Column {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,8 @@ impl Row {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,8 +110,8 @@ impl Row {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,8 +115,8 @@ impl Heading {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -157,8 +157,8 @@ impl Heading {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ impl Heading {
|
||||||
|
|
||||||
pub fn alter_display(&mut self, display: HeadingDisplay) -> &mut Self {
|
pub fn alter_display(&mut self, display: HeadingDisplay) -> &mut Self {
|
||||||
self.display = display;
|
self.display = display;
|
||||||
self.classes.alter(match &self.display() {
|
self.classes.alter(ClassesOp::SetDefault, match &self.display() {
|
||||||
HeadingDisplay::XxLarge => "display-2",
|
HeadingDisplay::XxLarge => "display-2",
|
||||||
HeadingDisplay::Large => "display-3",
|
HeadingDisplay::Large => "display-3",
|
||||||
HeadingDisplay::Medium => "display-4",
|
HeadingDisplay::Medium => "display-4",
|
||||||
|
|
@ -182,7 +182,7 @@ impl Heading {
|
||||||
HeadingDisplay::XxSmall => "display-6",
|
HeadingDisplay::XxSmall => "display-6",
|
||||||
HeadingDisplay::Normal => "",
|
HeadingDisplay::Normal => "",
|
||||||
HeadingDisplay::Subtitle => "",
|
HeadingDisplay::Subtitle => "",
|
||||||
}, ClassesOp::SetDefault);
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ impl ComponentTrait for Icon {
|
||||||
.with_version("1.8.2")
|
.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 {
|
fn default_render(&self, _context: &mut InContext) -> Markup {
|
||||||
|
|
@ -78,8 +78,8 @@ impl Icon {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,8 +105,8 @@ impl Icon {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,8 @@ impl Image {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,8 +107,8 @@ impl Image {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,8 +266,8 @@ impl Menu {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -298,8 +298,8 @@ impl Menu {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,8 @@ impl Paragraph {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_classes(mut self, classes: &str, op: ClassesOp) -> Self {
|
pub fn with_classes(mut self, op: ClassesOp, classes: &str) -> Self {
|
||||||
self.alter_classes(classes, op);
|
self.alter_classes(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -120,8 +120,8 @@ impl Paragraph {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.classes.alter(classes, op);
|
self.classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -132,14 +132,14 @@ impl Paragraph {
|
||||||
|
|
||||||
pub fn alter_display(&mut self, display: ParagraphDisplay) -> &mut Self {
|
pub fn alter_display(&mut self, display: ParagraphDisplay) -> &mut Self {
|
||||||
self.display = display;
|
self.display = display;
|
||||||
self.classes.alter(match &self.display() {
|
self.classes.alter(ClassesOp::SetDefault, match &self.display() {
|
||||||
ParagraphDisplay::XxLarge => "fs-2",
|
ParagraphDisplay::XxLarge => "fs-2",
|
||||||
ParagraphDisplay::Large => "fs-3",
|
ParagraphDisplay::Large => "fs-3",
|
||||||
ParagraphDisplay::Medium => "fs-4",
|
ParagraphDisplay::Medium => "fs-4",
|
||||||
ParagraphDisplay::Small => "fs-5",
|
ParagraphDisplay::Small => "fs-5",
|
||||||
ParagraphDisplay::XxSmall => "fs-6",
|
ParagraphDisplay::XxSmall => "fs-6",
|
||||||
ParagraphDisplay::Normal => "",
|
ParagraphDisplay::Normal => "",
|
||||||
}, ClassesOp::SetDefault);
|
});
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ async fn demo() -> app::Result<Markup> {
|
||||||
Page::new()
|
Page::new()
|
||||||
.with_title(l("page_title").as_str())
|
.with_title(l("page_title").as_str())
|
||||||
.add_to("content", hello_world())
|
.add_to("content", hello_world())
|
||||||
.add_to("content", just_visiting())
|
.add_to("content", welcome())
|
||||||
.add_to("content", about_pagetop())
|
.add_to("content", about_pagetop())
|
||||||
.add_to("content", promo_pagetop())
|
.add_to("content", promo_pagetop())
|
||||||
.add_to("content", reporting_problems())
|
.add_to("content", reporting_problems())
|
||||||
|
|
@ -39,10 +39,16 @@ fn hello_world() -> Container {
|
||||||
Container::header()
|
Container::header()
|
||||||
.with_id("hello-world")
|
.with_id("hello-world")
|
||||||
.with_component(grid::Row::new()
|
.with_component(grid::Row::new()
|
||||||
.with_layout(
|
.with_layout(&[
|
||||||
&[LayoutSet::PaddingSide(UnitValue::RelEm(2.0), UnitValue::RelPct(5.0))]
|
LayoutSet::PaddingTop(UnitValue::RelEm(2.0)),
|
||||||
)
|
LayoutSet::PaddingBottom(UnitValue::RelEm(2.0)),
|
||||||
|
LayoutSet::PaddingLeft(UnitValue::RelPct(2.0)),
|
||||||
|
])
|
||||||
.with_column(grid::Column::new()
|
.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_size(grid::ColumnSize::Is4of12)
|
||||||
.with_component(Heading::h1(html! {
|
.with_component(Heading::h1(html! {
|
||||||
(l("page_title"))
|
(l("page_title"))
|
||||||
|
|
@ -50,18 +56,14 @@ fn hello_world() -> Container {
|
||||||
.with_display(HeadingDisplay::Medium)
|
.with_display(HeadingDisplay::Medium)
|
||||||
)
|
)
|
||||||
.with_component(Paragraph::with(html! {
|
.with_component(Paragraph::with(html! {
|
||||||
(t("welcome_to", &args!["app" => SETTINGS.app.name.as_str()]))
|
(e("hello_intro", &args![
|
||||||
})
|
|
||||||
)
|
|
||||||
.with_component(Paragraph::with(html! {
|
|
||||||
(e("welcome_intro", &args![
|
|
||||||
"app" => format!("<strong>{}</strong>", &SETTINGS.app.name)
|
"app" => format!("<strong>{}</strong>", &SETTINGS.app.name)
|
||||||
]))
|
]))
|
||||||
})
|
})
|
||||||
.with_display(ParagraphDisplay::Small)
|
.with_display(ParagraphDisplay::Small)
|
||||||
)
|
)
|
||||||
.with_component(Paragraph::with(html! {
|
.with_component(Paragraph::with(html! {
|
||||||
(e("welcome_pagetop", &args![
|
(e("hello_pagetop", &args![
|
||||||
"pagetop" => "<a href=\"https://pagetop-rs\">PageTop</a>"
|
"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()
|
Container::new()
|
||||||
.with_id("visiting")
|
.with_id("visiting")
|
||||||
.with_component(grid::Row::new()
|
.with_component(grid::Row::new()
|
||||||
.with_layout(
|
.with_layout(&[
|
||||||
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
|
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
|
||||||
)
|
])
|
||||||
.with_column(grid::Column::new()
|
.with_column(grid::Column::new()
|
||||||
.with_layout(&[LayoutSet::PaddingAll(UnitValue::RelPct(2.0))])
|
.with_layout(&[LayoutSet::PaddingAll(UnitValue::RelPct(2.0))])
|
||||||
.with_size(grid::ColumnSize::Is5of12)
|
.with_size(grid::ColumnSize::Is5of12)
|
||||||
|
|
@ -105,20 +107,19 @@ fn just_visiting() -> Container {
|
||||||
LayoutSet::PaddingLeft(UnitValue::RelPct(5.0)),
|
LayoutSet::PaddingLeft(UnitValue::RelPct(5.0)),
|
||||||
])
|
])
|
||||||
.with_component(Heading::h2(html! {
|
.with_component(Heading::h2(html! {
|
||||||
(l("visiting_title"))
|
(t("welcome_to", &args!["app" => SETTINGS.app.name.as_str()]))
|
||||||
})
|
}))
|
||||||
)
|
|
||||||
.with_component(Heading::h3(html! {
|
.with_component(Heading::h3(html! {
|
||||||
(l("visiting_subtitle"))
|
(l("welcome_subtitle"))
|
||||||
})
|
})
|
||||||
.with_display(HeadingDisplay::Subtitle)
|
.with_display(HeadingDisplay::Subtitle)
|
||||||
)
|
)
|
||||||
.with_component(Paragraph::with(html! {
|
.with_component(Paragraph::with(html! {
|
||||||
(l("visiting_text1"))
|
(l("welcome_text1"))
|
||||||
})
|
})
|
||||||
.with_display(ParagraphDisplay::Small)
|
.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()
|
Container::new()
|
||||||
.with_id("pagetop")
|
.with_id("pagetop")
|
||||||
.with_component(grid::Row::new()
|
.with_component(grid::Row::new()
|
||||||
.with_layout(
|
.with_layout(&[
|
||||||
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
|
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
|
||||||
)
|
])
|
||||||
.with_column(grid::Column::new()
|
.with_column(grid::Column::new()
|
||||||
.with_layout(&[
|
.with_layout(&[
|
||||||
LayoutSet::PaddingTop(UnitValue::RelPct(2.5)),
|
LayoutSet::PaddingTop(UnitValue::RelPct(2.5)),
|
||||||
|
|
@ -165,9 +166,9 @@ fn promo_pagetop() -> Container {
|
||||||
Container::new()
|
Container::new()
|
||||||
.with_id("promo")
|
.with_id("promo")
|
||||||
.with_component(grid::Row::new()
|
.with_component(grid::Row::new()
|
||||||
.with_layout(
|
.with_layout(&[
|
||||||
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
|
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
|
||||||
)
|
])
|
||||||
.with_column(grid::Column::new()
|
.with_column(grid::Column::new()
|
||||||
.with_layout(&[LayoutSet::PaddingAll(UnitValue::RelPct(2.0))])
|
.with_layout(&[LayoutSet::PaddingAll(UnitValue::RelPct(2.0))])
|
||||||
.with_size(grid::ColumnSize::Is5of12)
|
.with_size(grid::ColumnSize::Is5of12)
|
||||||
|
|
@ -197,9 +198,9 @@ fn reporting_problems() -> Container {
|
||||||
Container::new()
|
Container::new()
|
||||||
.with_id("reporting")
|
.with_id("reporting")
|
||||||
.with_component(grid::Row::new()
|
.with_component(grid::Row::new()
|
||||||
.with_layout(
|
.with_layout(&[
|
||||||
&[LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))]
|
LayoutSet::PaddingSide(UnitValue::RelEm(1.0), UnitValue::RelPct(5.0))
|
||||||
)
|
])
|
||||||
.with_column(grid::Column::new()
|
.with_column(grid::Column::new()
|
||||||
.with_layout(&[
|
.with_layout(&[
|
||||||
LayoutSet::PaddingTop(UnitValue::RelPct(2.5)),
|
LayoutSet::PaddingTop(UnitValue::RelPct(2.5)),
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,13 @@ module_description = Displays a demo homepage when none is configured.
|
||||||
|
|
||||||
page_title = Hello world!
|
page_title = Hello world!
|
||||||
|
|
||||||
welcome_to = Welcome to { $app }
|
hello_intro = This page is used to test the proper operation of { $app } after installation.
|
||||||
welcome_intro = This page is used to test the proper operation of { $app } after installation.
|
hello_pagetop = This web solution is powered by { $pagetop }.
|
||||||
welcome_pagetop = This web solution is powered by { $pagetop }.
|
|
||||||
|
|
||||||
visiting_title = Just visiting?
|
welcome_to = Welcome to { $app }
|
||||||
visiting_subtitle = Are you user of this website?
|
welcome_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.
|
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.
|
||||||
visiting_text2 = If the problem persists, please contact your system administrator.
|
welcome_text2 = If the problem persists, please contact your system administrator.
|
||||||
|
|
||||||
pagetop_title = About PageTop
|
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.
|
pagetop_text1 = If you can read this page, it means that the PageTop server is working properly, but has not yet been configured.
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,13 @@ module_description = Muestra una página de demostración predeterminada cuando
|
||||||
|
|
||||||
page_title = ¡Hola mundo!
|
page_title = ¡Hola mundo!
|
||||||
|
|
||||||
welcome_to = Bienvenido a { $app }
|
hello_intro = Esta página se utiliza para probar el correcto funcionamiento de { $app } después de la instalación.
|
||||||
welcome_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 }.
|
||||||
welcome_pagetop = Esta solución web funciona con { $pagetop }.
|
|
||||||
|
|
||||||
visiting_title = ¿Sólo de visita?
|
welcome_to = Bienvenido a { $app }
|
||||||
visiting_subtitle = ¿Eres usuario de este sitio web?
|
welcome_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.
|
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.
|
||||||
visiting_text2 = Si el problema persiste, póngase en contacto con el administrador del sistema.
|
welcome_text2 = Si el problema persiste, póngase en contacto con el administrador del sistema.
|
||||||
|
|
||||||
pagetop_title = Sobre PageTop
|
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.
|
pagetop_text1 = Si puedes leer esta página, significa que el servidor PageTop funciona correctamente, pero aún no se ha configurado.
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,14 @@ impl ThemeTrait for Bulmix {
|
||||||
match component.handler() {
|
match component.handler() {
|
||||||
ANCHOR_COMPONENT => {
|
ANCHOR_COMPONENT => {
|
||||||
let a = component_mut::<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",
|
AnchorType::Button => "button is-primary",
|
||||||
_ => "",
|
_ => "",
|
||||||
}, ClassesOp::SetDefault);
|
});
|
||||||
},
|
},
|
||||||
HEADING_COMPONENT => {
|
HEADING_COMPONENT => {
|
||||||
let h = component_mut::<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::XxLarge => "title is-1",
|
||||||
HeadingDisplay::Large => "title is-2",
|
HeadingDisplay::Large => "title is-2",
|
||||||
HeadingDisplay::Medium => "title is-3",
|
HeadingDisplay::Medium => "title is-3",
|
||||||
|
|
@ -51,22 +51,22 @@ impl ThemeTrait for Bulmix {
|
||||||
HeadingDisplay::XxSmall => "title is-5",
|
HeadingDisplay::XxSmall => "title is-5",
|
||||||
HeadingDisplay::Normal => "title",
|
HeadingDisplay::Normal => "title",
|
||||||
HeadingDisplay::Subtitle => "subtitle",
|
HeadingDisplay::Subtitle => "subtitle",
|
||||||
}, ClassesOp::SetDefault);
|
});
|
||||||
},
|
},
|
||||||
PARAGRAPH_COMPONENT => {
|
PARAGRAPH_COMPONENT => {
|
||||||
let p = component_mut::<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::XxLarge => "is-size-2",
|
||||||
ParagraphDisplay::Large => "is-size-3",
|
ParagraphDisplay::Large => "is-size-3",
|
||||||
ParagraphDisplay::Medium => "is-size-4",
|
ParagraphDisplay::Medium => "is-size-4",
|
||||||
ParagraphDisplay::Small => "is-size-5",
|
ParagraphDisplay::Small => "is-size-5",
|
||||||
ParagraphDisplay::XxSmall => "is-size-6",
|
ParagraphDisplay::XxSmall => "is-size-6",
|
||||||
ParagraphDisplay::Normal => "",
|
ParagraphDisplay::Normal => "",
|
||||||
}, ClassesOp::SetDefault);
|
});
|
||||||
},
|
},
|
||||||
grid::COLUMN_COMPONENT => {
|
grid::COLUMN_COMPONENT => {
|
||||||
let col = component_mut::<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::Default => "",
|
||||||
grid::ColumnSize::Is1of12 => " is-1",
|
grid::ColumnSize::Is1of12 => " is-1",
|
||||||
grid::ColumnSize::Is2of12 => " is-2",
|
grid::ColumnSize::Is2of12 => " is-2",
|
||||||
|
|
@ -80,11 +80,11 @@ impl ThemeTrait for Bulmix {
|
||||||
grid::ColumnSize::Is10of12 => " is-10",
|
grid::ColumnSize::Is10of12 => " is-10",
|
||||||
grid::ColumnSize::Is11of12 => " is-11",
|
grid::ColumnSize::Is11of12 => " is-11",
|
||||||
grid::ColumnSize::IsFull => " is-12",
|
grid::ColumnSize::IsFull => " is-12",
|
||||||
}, " content").as_str(), ClassesOp::SetDefault);
|
}, " content").as_str());
|
||||||
},
|
},
|
||||||
grid::ROW_COMPONENT => {
|
grid::ROW_COMPONENT => {
|
||||||
let row = component_mut::<grid::Row>(component);
|
let row = component_mut::<grid::Row>(component);
|
||||||
row.alter_classes("columns", ClassesOp::SetDefault);
|
row.alter_classes(ClassesOp::SetDefault, "columns");
|
||||||
},
|
},
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@ impl Classes {
|
||||||
|
|
||||||
pub fn new_with_default(default: &str) -> Self {
|
pub fn new_with_default(default: &str) -> Self {
|
||||||
let mut classes = Self::new();
|
let mut classes = Self::new();
|
||||||
classes.alter(default, ClassesOp::SetDefault);
|
classes.alter(ClassesOp::SetDefault, default);
|
||||||
classes
|
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();
|
let classes = classes.trim();
|
||||||
match op {
|
match op {
|
||||||
ClassesOp::Add => {
|
ClassesOp::Add => {
|
||||||
|
|
|
||||||
|
|
@ -107,8 +107,8 @@ impl<'a> Page<'a> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alter_body_classes(&mut self, classes: &str, op: ClassesOp) -> &mut Self {
|
pub fn alter_body_classes(&mut self, op: ClassesOp, classes: &str) -> &mut Self {
|
||||||
self.body_classes.alter(classes, op);
|
self.body_classes.alter(op, classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue