From a0416e567070f4198cba2a7b15f8b23016529542 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sat, 7 Nov 2026 16:39:54 +0100 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20(pagetop):=20Adapta=20exte?= =?UTF-8?q?nsiones=20a=20Routes=20y=20StaticFiles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extensions/pagetop-aliner/src/lib.rs | 6 +++--- extensions/pagetop-cron/src/lib.rs | 6 +++--- extensions/pagetop-htmx/src/hx_table.rs | 2 +- extensions/pagetop-htmx/src/lib.rs | 6 +++--- extensions/pagetop-htmx/src/response.rs | 8 ++++---- extensions/pagetop-htmx/tests/extension.rs | 4 ++-- extensions/pagetop-htmx/tests/request.rs | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/extensions/pagetop-aliner/src/lib.rs b/extensions/pagetop-aliner/src/lib.rs index 9775a990..4f77e257 100644 --- a/extensions/pagetop-aliner/src/lib.rs +++ b/extensions/pagetop-aliner/src/lib.rs @@ -104,9 +104,9 @@ impl Extension for Aliner { Some(&Self) } - fn configure_static_files(&self, router: Router) -> Router { - serve_static_files!(router, [aliner] => "/aliner"); - router + fn configure_static_files(&self, files: StaticFiles) -> StaticFiles { + serve_static_files!(files, [aliner] => "/aliner"); + files } } diff --git a/extensions/pagetop-cron/src/lib.rs b/extensions/pagetop-cron/src/lib.rs index 2cb3ff9b..bf33960a 100644 --- a/extensions/pagetop-cron/src/lib.rs +++ b/extensions/pagetop-cron/src/lib.rs @@ -391,11 +391,11 @@ impl Extension for Cron { scheduler::shutdown().await; } - fn configure_router(&self, router: Router) -> Router { + fn configure_router(&self, routes: Routes) -> Routes { if config::SETTINGS.mode != config::CronMode::External { - return router; + return routes; } - router.route(TRIGGER_PATH, web::post(trigger_post).fallback(not_found)) + routes.public_route(TRIGGER_PATH, web::post(trigger_post).fallback(not_found)) } } diff --git a/extensions/pagetop-htmx/src/hx_table.rs b/extensions/pagetop-htmx/src/hx_table.rs index 4ae29ac0..1745fd10 100644 --- a/extensions/pagetop-htmx/src/hx_table.rs +++ b/extensions/pagetop-htmx/src/hx_table.rs @@ -70,7 +70,7 @@ use crate::hx; /// [`SortLink`]: pagetop::base::component::table::SortLink /// [`SortLink::with_prop()`]: pagetop::base::component::table::SortLink::with_prop /// [`SortLink::with_dir()`]: pagetop::base::component::table::SortLink::with_dir -/// [`Context::route()`]: pagetop::core::component::Context::route +/// [`Context::route()`]: pagetop::core::component::Contextual::route pub fn sort_link( href: impl Into, target: impl AsRef, diff --git a/extensions/pagetop-htmx/src/lib.rs b/extensions/pagetop-htmx/src/lib.rs index f4b46df6..edaf1c3f 100644 --- a/extensions/pagetop-htmx/src/lib.rs +++ b/extensions/pagetop-htmx/src/lib.rs @@ -147,9 +147,9 @@ impl Extension for Htmx { actions![action::page::BeforeRenderBody::new(add_htmx_script)] } - fn configure_static_files(&self, router: Router) -> Router { - serve_static_files!(router, [htmx] => "/htmx"); - router + fn configure_static_files(&self, files: StaticFiles) -> StaticFiles { + serve_static_files!(files, [htmx] => "/htmx"); + files } } diff --git a/extensions/pagetop-htmx/src/response.rs b/extensions/pagetop-htmx/src/response.rs index c44505e0..f31600e6 100644 --- a/extensions/pagetop-htmx/src/response.rs +++ b/extensions/pagetop-htmx/src/response.rs @@ -141,7 +141,7 @@ impl HtmxResponse { /// objetivo definido por el destino. Para personalizar `target`, `swap`, `select` o `values`, /// usa [`location_json()`](Self::location_json). /// - /// Usa [`Context::route()`](pagetop::core::component::Context::route) en lugar de un literal + /// Usa [`Context::route()`](pagetop::core::component::Contextual::route) en lugar de un literal /// para que la URL preserve el parámetro `lang` cuando corresponda: /// /// ```rust,no_run @@ -213,7 +213,7 @@ impl HtmxResponse { /// El usuario podrá navegar hacia atrás hasta esa URL. Usar `"false"` para desactivar el empuje /// aunque esté habilitado por el atributo `hx-push-url` del elemento. /// - /// Usa [`Context::route()`](pagetop::core::component::Context::route) en lugar de un literal + /// Usa [`Context::route()`](pagetop::core::component::Contextual::route) en lugar de un literal /// para que la URL preserve el parámetro `lang` cuando corresponda: /// /// ```rust,no_run @@ -231,7 +231,7 @@ impl HtmxResponse { /// Reemplaza la URL actual en el historial sin añadir una nueva entrada. /// /// Usar `"false"` para desactivar el reemplazo. Usa - /// [`Context::route()`](pagetop::core::component::Context::route) en lugar de un literal para + /// [`Context::route()`](pagetop::core::component::Contextual::route) en lugar de un literal para /// que la URL preserve el parámetro `lang` cuando corresponda. pub fn replace_url(self, url: impl Into) -> Self { self.set_header(hx::response::REPLACE_URL.as_bytes(), url.into().to_string()) @@ -242,7 +242,7 @@ impl HtmxResponse { /// A diferencia de [`location()`](Self::location), esta redirección recarga la página por /// completo, como un `window.location.href = url` en JavaScript. /// - /// Usa [`Context::route()`](pagetop::core::component::Context::route) en lugar de un literal + /// Usa [`Context::route()`](pagetop::core::component::Contextual::route) en lugar de un literal /// para que la URL preserve el parámetro `lang` cuando corresponda: /// /// ```rust,no_run diff --git a/extensions/pagetop-htmx/tests/extension.rs b/extensions/pagetop-htmx/tests/extension.rs index 36c21704..beccc761 100644 --- a/extensions/pagetop-htmx/tests/extension.rs +++ b/extensions/pagetop-htmx/tests/extension.rs @@ -9,8 +9,8 @@ impl Extension for TestApp { vec![&Htmx] } - fn configure_router(&self, router: Router) -> Router { - router.route("/page", web::get(render_page)) + fn configure_router(&self, routes: Routes) -> Routes { + routes.public_route("/page", web::get(render_page)) } } diff --git a/extensions/pagetop-htmx/tests/request.rs b/extensions/pagetop-htmx/tests/request.rs index 90995ec0..729b0c85 100644 --- a/extensions/pagetop-htmx/tests/request.rs +++ b/extensions/pagetop-htmx/tests/request.rs @@ -5,8 +5,8 @@ struct TestApp; #[async_trait] impl Extension for TestApp { - fn configure_router(&self, router: Router) -> Router { - router.route("/echo", web::get(echo_request)) + fn configure_router(&self, routes: Routes) -> Routes { + routes.public_route("/echo", web::get(echo_request)) } }