♻️ (pagetop): Adapta extensiones a Routes y StaticFiles
This commit is contained in:
parent
4062a57cff
commit
a0416e5670
7 changed files with 18 additions and 18 deletions
|
|
@ -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<RoutePath>,
|
||||
target: impl AsRef<str>,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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<RoutePath>) -> 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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue