✨ (pagetop): Mejora la elección de zona horaria
- Nuevas opciones `app.timezone_regions`, `app.timezone_order` y `app.timezone_per_user` para limitar y ordenar las regiones ofrecidas y decidir si cada usuario puede tener su propia zona horaria. - Añade `TzRegion` y `TimezoneOrder`; `Timezone::supported_by_region()` devuelve ahora `TzRegion` y excluye los alias de la base IANA que repiten otra zona (tzdata 2025b). - Añade `Timezone::is_supported_in()` para validar con otras regiones. - `SelectTimezone` admite `with_regions()`, `with_order()` y `with_utc_offset()`, muestra nombres legibles y conserva la zona actual aunque ya no se ofrezca. - `app.timezone` se resuelve sin distinguir mayúsculas. - pagetop-user no ofrece idioma ni zona horaria si no se aplican y conserva lo guardado; acepta la zona actual aunque ya no se ofrezca.
This commit is contained in:
parent
f819181872
commit
346714ab29
19 changed files with 1257 additions and 131 deletions
|
|
@ -3,6 +3,7 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
use crate::LOCALES_USER;
|
||||
use crate::config::{user_language_applies, user_timezone_applies};
|
||||
use crate::user_path;
|
||||
use crate::{ADMIN_USERS_PATH, PROFILE_EDIT_PATH};
|
||||
|
||||
|
|
@ -86,25 +87,33 @@ impl Component for UserForm {
|
|||
.with_name("display_name")
|
||||
.with_value(self.display_name())
|
||||
.with_label(Lc::t("field-display-name", &LOCALES_USER)),
|
||||
)
|
||||
.with_child(
|
||||
);
|
||||
|
||||
// Sólo se ofrecen si se aplican (ver `config::user_language_applies()` y
|
||||
// `config::user_timezone_applies()`).
|
||||
if user_language_applies() {
|
||||
form = form.with_child(
|
||||
form::SelectLanguage::new()
|
||||
.with_name("language")
|
||||
.with_label(Lc::t("field-language", &LOCALES_USER))
|
||||
.with_selected(self.language()),
|
||||
)
|
||||
.with_child(
|
||||
);
|
||||
}
|
||||
if user_timezone_applies() {
|
||||
form = form.with_child(
|
||||
form::SelectTimezone::new()
|
||||
.with_name("timezone")
|
||||
.with_label(Lc::t("field-timezone", &LOCALES_USER))
|
||||
.with_utc_offset(true)
|
||||
.with_selected(self.timezone()),
|
||||
)
|
||||
.with_child(
|
||||
form::SelectTheme::new()
|
||||
.with_name("theme")
|
||||
.with_label(Lc::t("field-theme", &LOCALES_USER))
|
||||
.with_selected(self.theme()),
|
||||
);
|
||||
}
|
||||
form = form.with_child(
|
||||
form::SelectTheme::new()
|
||||
.with_name("theme")
|
||||
.with_label(Lc::t("field-theme", &LOCALES_USER))
|
||||
.with_selected(self.theme()),
|
||||
);
|
||||
|
||||
if *self.mode() == UserFormMode::New {
|
||||
form = form.with_child(PasswordConfirm::new());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue