♻️ Atributos class e id explícitos en html!

Se usa `class="..."` e `id="..."` en lugar de `div.a #x`. El HTML
generado es idéntico.
This commit is contained in:
Manuel Cillero 2026-09-26 07:05:59 +02:00
parent 58d1fef4f1
commit 3f3634fdab
21 changed files with 80 additions and 74 deletions

View file

@ -111,13 +111,13 @@ impl Component for RoleTable {
Ok(html! {
div (self.props().unpack(cx)) {
div.user-admin-actions {
div class="user-admin-actions" {
a href=(new_href) {
(Lc::t("btn-create-role", &LOCALES_USER).using(cx))
}
}
@if let Some(message) = self.message() {
div.user-form-error role="alert" { (message.clone().using(cx)) }
div class="user-form-error" role="alert" { (message.clone().using(cx)) }
}
(table.render(cx).await)
(pager)

View file

@ -87,7 +87,7 @@ impl Component for UserTable {
Ok(html! {
div (self.props().unpack(cx)) {
div.user-admin-actions {
div class="user-admin-actions" {
a href=(new_href) {
(Lc::t("btn-create-user", &LOCALES_USER).using(cx))
}

View file

@ -69,8 +69,8 @@ impl Component for LoginForm {
let form = form.render(cx).await;
Ok(html! {
div.user-login-page {
div.user-login-card {
div class="user-login-page" {
div class="user-login-card" {
(form)
}
}
@ -82,13 +82,13 @@ fn links(allow_registration: bool) -> Html {
Html::with(move |cx| {
html! {
@if allow_registration {
p.user-register-link {
p class="user-register-link" {
a href=(cx.route(REGISTER_PATH)) {
(Lc::t("link-register", &LOCALES_USER).using(cx))
}
}
}
p.user-reset-link {
p class="user-reset-link" {
a href=(cx.route(PASSWORD_RESET_PATH)) {
(Lc::t("link-forgot-password", &LOCALES_USER).using(cx))
}

View file

@ -19,10 +19,10 @@ impl Component for UserBlock {
Ok(if user.is_authenticated() {
let display = user.display_name().unwrap_or("?");
html! {
nav.user-block {
span.user-name { (display) }
nav class="user-block" {
span class="user-name" { (display) }
" · "
form.user-logout-inline method="post" action=(cx.route(LOGOUT_PATH)) {
form class="user-logout-inline" method="post" action=(cx.route(LOGOUT_PATH)) {
button type="submit" {
(Lc::t("btn-logout", &LOCALES_USER).using(cx))
}
@ -31,7 +31,7 @@ impl Component for UserBlock {
}
} else {
html! {
nav.user-block {
nav class="user-block" {
a href=(cx.route(LOGIN_PATH)) {
(Lc::t("btn-login", &LOCALES_USER).using(cx))
}