Añade referencias a todos los métodos
El proyecto compila, pendiente de una solución para los contenedores.
This commit is contained in:
parent
53dd1f24c7
commit
4dd57eab43
12 changed files with 115 additions and 102 deletions
|
|
@ -32,7 +32,7 @@ impl ModuleTrait for UserModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn form_login() -> ArcComponent {
|
fn form_login() -> ArcComponent {
|
||||||
Form::new()
|
Form::new()/*
|
||||||
.with_id("user-login")
|
.with_id("user-login")
|
||||||
.add(form::Input::textfield()
|
.add(form::Input::textfield()
|
||||||
.with_name("name")
|
.with_name("name")
|
||||||
|
|
@ -49,7 +49,7 @@ fn form_login() -> ArcComponent {
|
||||||
.with_help_text(l("password_help").as_str())
|
.with_help_text(l("password_help").as_str())
|
||||||
.arc()
|
.arc()
|
||||||
)
|
)
|
||||||
.add(form::Button::submit(l("login").as_str()).arc())
|
.add(form::Button::submit(l("login").as_str()).arc())*/
|
||||||
.arc()
|
.arc()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,11 +57,11 @@ async fn login() -> app::Result<Markup> {
|
||||||
Page::new()
|
Page::new()
|
||||||
.with_title(
|
.with_title(
|
||||||
"Identificación del usuario"
|
"Identificación del usuario"
|
||||||
)
|
)/*
|
||||||
.add_to("content", Container::new()
|
.add_to("content", Container::new()
|
||||||
.with_id("welcome")
|
.with_id("welcome")
|
||||||
.add(form_login())
|
.add(form_login())
|
||||||
.arc()
|
.arc()
|
||||||
)
|
)*/
|
||||||
.render()
|
.render()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,47 +51,49 @@ impl PageComponent for Block {
|
||||||
|
|
||||||
impl Block {
|
impl Block {
|
||||||
pub fn with(html: Markup) -> Self {
|
pub fn with(html: Markup) -> Self {
|
||||||
Block::new().add(html)
|
let mut block = Block::new();
|
||||||
|
block.add(html);
|
||||||
|
block
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block BUILDER.
|
// Block BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_title(mut self, title: &str) -> Self {
|
pub fn with_title(&mut self, title: &str) -> &Self {
|
||||||
self.title.with_value(title);
|
self.title.with_value(title);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add(mut self, html: Markup) -> Self {
|
pub fn add(&mut self, html: Markup) -> &Self {
|
||||||
self.html.push(html);
|
self.html.push(html);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_id(mut self, id: &str) -> Self {
|
pub fn with_id(&mut self, id: &str) -> &Self {
|
||||||
self.id.with_value(id);
|
self.id.with_value(id);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,27 +36,29 @@ impl PageComponent for Chunck {
|
||||||
|
|
||||||
impl Chunck {
|
impl Chunck {
|
||||||
pub fn with(html: Markup) -> Self {
|
pub fn with(html: Markup) -> Self {
|
||||||
Chunck::new().add(html)
|
let mut chunck = Chunck::new();
|
||||||
|
chunck.add(html);
|
||||||
|
chunck
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chunck BUILDER.
|
// Chunck BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add(mut self, html: Markup) -> Self {
|
pub fn add(&mut self, html: Markup) -> &Self {
|
||||||
self.html.push(html);
|
self.html.push(html);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,12 +99,12 @@ impl Container {
|
||||||
|
|
||||||
// Container BUILDER.
|
// Container BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
@ -114,22 +114,22 @@ impl Container {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_id(mut self, id: &str) -> Self {
|
pub fn with_id(&mut self, id: &str) -> &Self {
|
||||||
self.id.with_value(id);
|
self.id.with_value(id);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,44 +68,48 @@ impl PageComponent for Button {
|
||||||
|
|
||||||
impl Button {
|
impl Button {
|
||||||
pub fn button(value: &str) -> Self {
|
pub fn button(value: &str) -> Self {
|
||||||
Button::new().with_value(value)
|
let mut button = Button::new();
|
||||||
|
button.with_value(value);
|
||||||
|
button
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset(value: &str) -> Self {
|
pub fn reset(value: &str) -> Self {
|
||||||
let mut button = Button::new().with_value(value);
|
let mut button = Button::new();
|
||||||
|
button.with_value(value);
|
||||||
button.button_type = ButtonType::Reset;
|
button.button_type = ButtonType::Reset;
|
||||||
button
|
button
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn submit(value: &str) -> Self {
|
pub fn submit(value: &str) -> Self {
|
||||||
let mut button = Button::new().with_value(value);
|
let mut button = Button::new();
|
||||||
|
button.with_value(value);
|
||||||
button.button_type = ButtonType::Submit;
|
button.button_type = ButtonType::Submit;
|
||||||
button
|
button
|
||||||
}
|
}
|
||||||
|
|
||||||
// Button BUILDER.
|
// Button BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_name(mut self, name: &str) -> Self {
|
pub fn with_name(&mut self, name: &str) -> &Self {
|
||||||
self.name.with_value(name);
|
self.name.with_value(name);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_value(mut self, value: &str) -> Self {
|
pub fn with_value(&mut self, value: &str) -> &Self {
|
||||||
self.value.with_value(value);
|
self.value.with_value(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_autofocus(mut self, toggle: bool) -> Self {
|
pub fn with_autofocus(&mut self, toggle: bool) -> &Self {
|
||||||
self.autofocus.with_value(match toggle {
|
self.autofocus.with_value(match toggle {
|
||||||
true => "autofocus",
|
true => "autofocus",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -113,7 +117,7 @@ impl Button {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_disabled(mut self, toggle: bool) -> Self {
|
pub fn with_disabled(&mut self, toggle: bool) -> &Self {
|
||||||
self.disabled.with_value(match toggle {
|
self.disabled.with_value(match toggle {
|
||||||
true => "disabled",
|
true => "disabled",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -121,17 +125,17 @@ impl Button {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,37 +95,37 @@ impl Date {
|
||||||
|
|
||||||
// Date BUILDER.
|
// Date BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_name(mut self, name: &str) -> Self {
|
pub fn with_name(&mut self, name: &str) -> &Self {
|
||||||
self.name.with_value(name);
|
self.name.with_value(name);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_value(mut self, value: &str) -> Self {
|
pub fn with_value(&mut self, value: &str) -> &Self {
|
||||||
self.value.with_value(value);
|
self.value.with_value(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_label(mut self, label: &str) -> Self {
|
pub fn with_label(&mut self, label: &str) -> &Self {
|
||||||
self.label.with_value(label);
|
self.label.with_value(label);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_placeholder(mut self, placeholder: &str) -> Self {
|
pub fn with_placeholder(&mut self, placeholder: &str) -> &Self {
|
||||||
self.placeholder.with_value(placeholder);
|
self.placeholder.with_value(placeholder);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_autofocus(mut self, toggle: bool) -> Self {
|
pub fn with_autofocus(&mut self, toggle: bool) -> &Self {
|
||||||
self.autofocus.with_value(match toggle {
|
self.autofocus.with_value(match toggle {
|
||||||
true => "autofocus",
|
true => "autofocus",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -133,7 +133,7 @@ impl Date {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_autocomplete(mut self, toggle: bool) -> Self {
|
pub fn with_autocomplete(&mut self, toggle: bool) -> &Self {
|
||||||
self.autocomplete.with_value(match toggle {
|
self.autocomplete.with_value(match toggle {
|
||||||
true => "",
|
true => "",
|
||||||
false => "off",
|
false => "off",
|
||||||
|
|
@ -141,7 +141,7 @@ impl Date {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_disabled(mut self, toggle: bool) -> Self {
|
pub fn with_disabled(&mut self, toggle: bool) -> &Self {
|
||||||
self.disabled.with_value(match toggle {
|
self.disabled.with_value(match toggle {
|
||||||
true => "disabled",
|
true => "disabled",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -149,7 +149,7 @@ impl Date {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_readonly(mut self, toggle: bool) -> Self {
|
pub fn with_readonly(&mut self, toggle: bool) -> &Self {
|
||||||
self.readonly.with_value(match toggle {
|
self.readonly.with_value(match toggle {
|
||||||
true => "readonly",
|
true => "readonly",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -157,7 +157,7 @@ impl Date {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_required(mut self, toggle: bool) -> Self {
|
pub fn with_required(&mut self, toggle: bool) -> &Self {
|
||||||
self.required.with_value(match toggle {
|
self.required.with_value(match toggle {
|
||||||
true => "required",
|
true => "required",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -165,22 +165,22 @@ impl Date {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_help_text(mut self, help_text: &str) -> Self {
|
pub fn with_help_text(&mut self, help_text: &str) -> &Self {
|
||||||
self.help_text.with_value(help_text);
|
self.help_text.with_value(help_text);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,27 +60,27 @@ impl Form {
|
||||||
|
|
||||||
// Form BUILDER.
|
// Form BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_action(mut self, action: &str) -> Self {
|
pub fn with_action(&mut self, action: &str) -> &Self {
|
||||||
self.action.with_value(action);
|
self.action.with_value(action);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_charset(mut self, charset: &str) -> Self {
|
pub fn with_charset(&mut self, charset: &str) -> &Self {
|
||||||
self.charset.with_value(charset);
|
self.charset.with_value(charset);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_method(mut self, method: FormMethod) -> Self {
|
pub fn with_method(&mut self, method: FormMethod) -> &Self {
|
||||||
self.method = method;
|
self.method = method;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
@ -90,22 +90,22 @@ impl Form {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_id(mut self, id: &str) -> Self {
|
pub fn with_id(&mut self, id: &str) -> &Self {
|
||||||
self.id.with_value(id);
|
self.id.with_value(id);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,22 +32,25 @@ impl PageComponent for Hidden {
|
||||||
|
|
||||||
impl Hidden {
|
impl Hidden {
|
||||||
pub fn set(name: &str, value: &str) -> Self {
|
pub fn set(name: &str, value: &str) -> Self {
|
||||||
Hidden::new().with_name(name).with_value(value)
|
let mut hidden = Hidden::new();
|
||||||
|
hidden.with_name(name);
|
||||||
|
hidden.with_value(value);
|
||||||
|
hidden
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hidden BUILDER.
|
// Hidden BUILDER.
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_name(mut self, name: &str) -> Self {
|
pub fn with_name(&mut self, name: &str) -> &Self {
|
||||||
self.name.with_value(name);
|
self.name.with_value(name);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_value(mut self, value: &str) -> Self {
|
pub fn with_value(&mut self, value: &str) -> &Self {
|
||||||
self.value.with_value(value);
|
self.value.with_value(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,52 +149,52 @@ impl Input {
|
||||||
|
|
||||||
// Input BUILDER.
|
// Input BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_name(mut self, name: &str) -> Self {
|
pub fn with_name(&mut self, name: &str) -> &Self {
|
||||||
self.name.with_value(name);
|
self.name.with_value(name);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_value(mut self, value: &str) -> Self {
|
pub fn with_value(&mut self, value: &str) -> &Self {
|
||||||
self.value.with_value(value);
|
self.value.with_value(value);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_label(mut self, label: &str) -> Self {
|
pub fn with_label(&mut self, label: &str) -> &Self {
|
||||||
self.label.with_value(label);
|
self.label.with_value(label);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_size(mut self, size: Option<u16>) -> Self {
|
pub fn with_size(&mut self, size: Option<u16>) -> &Self {
|
||||||
self.size = size;
|
self.size = size;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_minlength(mut self, minlength: Option<u16>) -> Self {
|
pub fn with_minlength(&mut self, minlength: Option<u16>) -> &Self {
|
||||||
self.minlength = minlength;
|
self.minlength = minlength;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_maxlength(mut self, maxlength: Option<u16>) -> Self {
|
pub fn with_maxlength(&mut self, maxlength: Option<u16>) -> &Self {
|
||||||
self.maxlength = maxlength;
|
self.maxlength = maxlength;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_placeholder(mut self, placeholder: &str) -> Self {
|
pub fn with_placeholder(&mut self, placeholder: &str) -> &Self {
|
||||||
self.placeholder.with_value(placeholder);
|
self.placeholder.with_value(placeholder);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_autofocus(mut self, toggle: bool) -> Self {
|
pub fn with_autofocus(&mut self, toggle: bool) -> &Self {
|
||||||
self.autofocus.with_value(match toggle {
|
self.autofocus.with_value(match toggle {
|
||||||
true => "autofocus",
|
true => "autofocus",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -202,7 +202,7 @@ impl Input {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_autocomplete(mut self, toggle: bool) -> Self {
|
pub fn with_autocomplete(&mut self, toggle: bool) -> &Self {
|
||||||
self.autocomplete.with_value(match toggle {
|
self.autocomplete.with_value(match toggle {
|
||||||
true => "",
|
true => "",
|
||||||
false => "off",
|
false => "off",
|
||||||
|
|
@ -210,7 +210,7 @@ impl Input {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_disabled(mut self, toggle: bool) -> Self {
|
pub fn with_disabled(&mut self, toggle: bool) -> &Self {
|
||||||
self.disabled.with_value(match toggle {
|
self.disabled.with_value(match toggle {
|
||||||
true => "disabled",
|
true => "disabled",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -218,7 +218,7 @@ impl Input {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_readonly(mut self, toggle: bool) -> Self {
|
pub fn with_readonly(&mut self, toggle: bool) -> &Self {
|
||||||
self.readonly.with_value(match toggle {
|
self.readonly.with_value(match toggle {
|
||||||
true => "readonly",
|
true => "readonly",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -226,7 +226,7 @@ impl Input {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_required(mut self, toggle: bool) -> Self {
|
pub fn with_required(&mut self, toggle: bool) -> &Self {
|
||||||
self.required.with_value(match toggle {
|
self.required.with_value(match toggle {
|
||||||
true => "required",
|
true => "required",
|
||||||
false => "",
|
false => "",
|
||||||
|
|
@ -234,22 +234,22 @@ impl Input {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_help_text(mut self, help_text: &str) -> Self {
|
pub fn with_help_text(&mut self, help_text: &str) -> &Self {
|
||||||
self.help_text.with_value(help_text);
|
self.help_text.with_value(help_text);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,12 @@ impl Column {
|
||||||
|
|
||||||
// Column BUILDER.
|
// Column BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
@ -61,22 +61,22 @@ impl Column {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_id(mut self, id: &str) -> Self {
|
pub fn with_id(&mut self, id: &str) -> &Self {
|
||||||
self.id.with_value(id);
|
self.id.with_value(id);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,12 +46,12 @@ impl Row {
|
||||||
|
|
||||||
// Row BUILDER.
|
// Row BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
@ -61,22 +61,22 @@ impl Row {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_id(mut self, id: &str) -> Self {
|
pub fn with_id(&mut self, id: &str) -> &Self {
|
||||||
self.id.with_value(id);
|
self.id.with_value(id);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,42 +41,44 @@ impl PageComponent for Image {
|
||||||
|
|
||||||
impl Image {
|
impl Image {
|
||||||
pub fn image(source: &str) -> Self {
|
pub fn image(source: &str) -> Self {
|
||||||
Image::new().with_source(source)
|
let mut image = Image::new();
|
||||||
|
image.with_source(source);
|
||||||
|
image
|
||||||
}
|
}
|
||||||
|
|
||||||
// Image BUILDER.
|
// Image BUILDER.
|
||||||
|
|
||||||
pub fn with_renderable(mut self, renderable: fn() -> bool) -> Self {
|
pub fn with_renderable(&mut self, renderable: fn() -> bool) -> &Self {
|
||||||
self.renderable = renderable;
|
self.renderable = renderable;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_weight(mut self, weight: i8) -> Self {
|
pub fn with_weight(&mut self, weight: i8) -> &Self {
|
||||||
self.weight = weight;
|
self.weight = weight;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_source(mut self, source: &str) -> Self {
|
pub fn with_source(&mut self, source: &str) -> &Self {
|
||||||
self.source.with_value(source);
|
self.source.with_value(source);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_id(mut self, id: &str) -> Self {
|
pub fn with_id(&mut self, id: &str) -> &Self {
|
||||||
self.id.with_value(id);
|
self.id.with_value(id);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_classes(mut self, classes: &str) -> Self {
|
pub fn set_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.set_classes(classes);
|
self.classes.set_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_classes(mut self, classes: &str) -> Self {
|
pub fn add_classes(&mut self, classes: &str) -> &Self {
|
||||||
self.classes.add_classes(classes);
|
self.classes.add_classes(classes);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn using_template(mut self, template: &str) -> Self {
|
pub fn using_template(&mut self, template: &str) -> &Self {
|
||||||
self.template = template.to_owned();
|
self.template = template.to_owned();
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue