(core): Añade Route, RoutePath y Waypoint

`Route` resuelve URLs sensibles al `Context`/idioma en propiedades de
componentes; `RoutePath` (renombrado desde html/route.rs) es el valor
concreto de ruta + query. `Waypoint` transporta la URL de retorno entre
pantallas de listado/alta/edición vía query string.

Ajusta `Context::route()`, `Redirect` y los componentes que aceptan
rutas para integrarse con el nuevo tipo `Route`.
This commit is contained in:
Manuel Cillero 2026-07-19 22:16:21 +02:00
parent 6f82da220b
commit af548b03c9
25 changed files with 819 additions and 216 deletions

View file

@ -23,7 +23,7 @@ async fn form_controls(request: HttpRequest) -> Result<Markup, ErrorPage> {
.with_opening(IntroOpening::Custom)
.with_title(L10n::t("title", &LOC))
.with_slogan(L10n::t("slogan", &LOC))
.with_button(None::<(L10n, FnPathByContext)>)
.with_button(None::<(L10n, Route)>)
// Bloque 1: casillas, interruptores y botones de opción.
.with_child(
Block::new()

View file

@ -18,7 +18,7 @@ async fn intro_colors(request: HttpRequest) -> Result<Markup, ErrorPage> {
.with_opening(IntroOpening::Custom)
.with_title(L10n::n("PageTop"))
.with_slogan(L10n::t("colors_slogan", &LOC))
.with_button(None::<(L10n, FnPathByContext)>)
.with_button(None::<(L10n, Route)>)
.with_child(
Block::new()
.with_title(L10n::t("colors_block", &LOC).with_arg("n", "1"))

View file

@ -20,13 +20,10 @@ impl Extension for SuperMenu {
.with_expand(token::BreakPoint::LG)
.with_item(bs::navbar::Item::nav(
bs::Nav::new()
.with_item(bs::nav::Item::link(
L10n::t("menus_item_link", &LOC),
|cx| cx.route("/"),
))
.with_item(bs::nav::Item::link(L10n::t("menus_item_link", &LOC), "/"))
.with_item(bs::nav::Item::link_blank(
L10n::t("menus_item_blank", &LOC),
|_| "https://docs.rs/pagetop".into(),
"https://docs.rs/pagetop",
))
.with_item(bs::nav::Item::dropdown(
bs::Dropdown::new()
@ -37,15 +34,15 @@ impl Extension for SuperMenu {
)))
.with_item(bs::dropdown::Item::link(
L10n::t("menus_dev_getting_started", &LOC),
|cx| cx.route("/dev/getting-started"),
"/dev/getting-started",
))
.with_item(bs::dropdown::Item::link(
L10n::t("menus_dev_guides", &LOC),
|cx| cx.route("/dev/guides"),
"/dev/guides",
))
.with_item(bs::dropdown::Item::link_blank(
L10n::t("menus_dev_forum", &LOC),
|_| "https://forum.example.dev".into(),
"https://forum.example.dev",
))
.with_item(bs::dropdown::Item::divider())
.with_item(bs::dropdown::Item::header(L10n::t(
@ -54,15 +51,15 @@ impl Extension for SuperMenu {
)))
.with_item(bs::dropdown::Item::link(
L10n::t("menus_sdk_rust", &LOC),
|cx| cx.route("/dev/sdks/rust"),
"/dev/sdks/rust",
))
.with_item(bs::dropdown::Item::link(
L10n::t("menus_sdk_js", &LOC),
|cx| cx.route("/dev/sdks/js"),
"/dev/sdks/js",
))
.with_item(bs::dropdown::Item::link(
L10n::t("menus_sdk_python", &LOC),
|cx| cx.route("/dev/sdks/python"),
"/dev/sdks/python",
))
.with_item(bs::dropdown::Item::divider())
.with_item(bs::dropdown::Item::header(L10n::t(
@ -71,22 +68,22 @@ impl Extension for SuperMenu {
)))
.with_item(bs::dropdown::Item::link(
L10n::t("menus_plugin_auth", &LOC),
|cx| cx.route("/dev/sdks/rust/plugins/auth"),
"/dev/sdks/rust/plugins/auth",
))
.with_item(bs::dropdown::Item::link(
L10n::t("menus_plugin_cache", &LOC),
|cx| cx.route("/dev/sdks/rust/plugins/cache"),
"/dev/sdks/rust/plugins/cache",
))
.with_item(bs::dropdown::Item::divider())
.with_item(bs::dropdown::Item::label(L10n::t("menus_item_label", &LOC)))
.with_item(bs::dropdown::Item::link_disabled(
L10n::t("menus_item_disabled", &LOC),
|cx| cx.route("#"),
"#",
)),
))
.with_item(bs::nav::Item::link_disabled(
L10n::t("menus_item_disabled", &LOC),
|cx| cx.route("#"),
"#",
)),
))
.with_item(bs::navbar::Item::nav(
@ -97,11 +94,11 @@ impl Extension for SuperMenu {
)))
.with_item(bs::nav::Item::link(
L10n::t("menus_item_sign_up", &LOC),
|cx| cx.route("/auth/sign-up"),
"/auth/sign-up",
))
.with_item(bs::nav::Item::link(
L10n::t("menus_item_login", &LOC),
|cx| cx.route("/auth/login"),
"/auth/login",
)),
));