🚚 Rename add_element() to more descriptive name

This commit is contained in:
Manuel Cillero 2024-02-29 23:34:31 +01:00
parent aba7c4d8ce
commit 5840dc215e
2 changed files with 4 additions and 4 deletions

View file

@ -43,7 +43,7 @@ async fn login(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
fn form_login() -> Form { fn form_login() -> Form {
Form::new() Form::new()
.with_id("user-login") .with_id("user-login")
.with_element( .add_element(
form::Input::textfield() form::Input::textfield()
.with_name("name") .with_name("name")
.with_label(L10n::t("username", &LOCALES_USER)) .with_label(L10n::t("username", &LOCALES_USER))
@ -53,11 +53,11 @@ fn form_login() -> Form {
) )
.with_autofocus(true), .with_autofocus(true),
) )
.with_element( .add_element(
form::Input::password() form::Input::password()
.with_name("pass") .with_name("pass")
.with_label(L10n::t("password", &LOCALES_USER)) .with_label(L10n::t("password", &LOCALES_USER))
.with_help_text(L10n::t("password_help", &LOCALES_USER)), .with_help_text(L10n::t("password_help", &LOCALES_USER)),
) )
.with_element(form::ActionButton::submit().with_value(L10n::t("login", &LOCALES_USER))) .add_element(form::ActionButton::submit().with_value(L10n::t("login", &LOCALES_USER)))
} }

View file

@ -98,7 +98,7 @@ impl Form {
} }
#[rustfmt::skip] #[rustfmt::skip]
pub fn with_element(mut self, element: impl ComponentTrait) -> Self { pub fn add_element(mut self, element: impl ComponentTrait) -> Self {
self.stuff.alter_value(ArcAnyOp::Add(ArcAnyComponent::new(element))); self.stuff.alter_value(ArcAnyOp::Add(ArcAnyComponent::new(element)));
self self
} }