Compare commits

..

2 commits

Author SHA1 Message Date
aae6c7df15 🎨 Mejora la página de bienvenida y el tema básico
Convierte la estructura de la página de bienvenida en una composición
del tema básico para ser usada en otros contextos. Por ejemplo, para la
página de mantenimiento, o la página de inicio de la guía de uso de
PageTop.
2025-09-18 14:17:01 +02:00
accab251d8 🚨 Ajustes menores sugeridos por clippy 2025-09-18 14:06:33 +02:00
8 changed files with 81 additions and 43 deletions

View file

@ -269,8 +269,8 @@ pub fn builder_fn(_: TokenStream, item: TokenStream) -> TokenStream {
// Extrae atributos descartando la documentación para incluir en `alter_...()`.
let non_doc_attrs: Vec<_> = attrs
.iter()
.filter(|&a| !a.path().is_ident("doc"))
.cloned()
.filter(|a| !a.path().is_ident("doc"))
.collect();
// Documentación del método alter_...().

View file

@ -30,22 +30,50 @@ async fn homepage(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
.with_title(L10n::l("welcome_title"))
.with_description(L10n::l("welcome_intro").with_arg("app", app))
.with_param("intro_button_text", L10n::l("welcome_powered"))
.with_param("intro_button_link", "https://pagetop.cillero.es".to_owned())
.add_component(Html::with(|cx| {
html! {
p { (L10n::l("welcome_text1").using(cx)) }
p { (L10n::l("welcome_text2").using(cx)) }
.with_param("intro_button_link", "https://pagetop.cillero.es".to_string())
.with_assets(AssetsOp::AddJavaScript(JavaScript::on_load_async("welcome-js", |cx|
util::indoc!(r#"
try {
const resp = await fetch("https://crates.io/api/v1/crates/pagetop");
const data = await resp.json();
const date = new Date(data.versions[0].created_at);
const formatted = date.toLocaleDateString("LANGID", { year: "numeric", month: "2-digit", day: "2-digit" });
document.getElementById("welcome-release").src = `https://img.shields.io/badge/Release%20date-${encodeURIComponent(formatted)}-blue?label=LABEL&style=for-the-badge`;
document.getElementById("welcome-badges").style.display = "block";
} catch (e) {
console.error("Failed to fetch release date from crates.io:", e);
}
"#)
.replace("LANGID", cx.langid().to_string().as_str())
.replace("LABEL", L10n::l("welcome_release_label").using(cx).as_str())
.to_string(),
)))
.add_component(Html::with(|cx| html! {
p { (L10n::l("welcome_text1").using(cx)) }
div id="welcome-badges" style="display: none; margin-bottom: 1.1rem;" {
img
src="https://img.shields.io/crates/v/pagetop.svg?label=PageTop&style=for-the-badge"
alt=[L10n::l("welcome_pagetop_label").lookup(cx)] {} (" ")
img
id="welcome-release"
alt=[L10n::l("welcome_release_label").lookup(cx)] {} (" ")
img
src=(format!(
"https://img.shields.io/badge/license-MIT%2FApache-blue.svg?label={}&style=for-the-badge",
L10n::l("welcome_license_label").lookup(cx).unwrap_or_default()
))
alt=[L10n::l("welcome_license_label").lookup(cx)] {}
}
p { (L10n::l("welcome_text2").using(cx)) }
}))
.add_component(
Block::new()
.with_title(L10n::l("welcome_about"))
.add_component(Html::with(move |cx| {
html! {
p { (L10n::l("welcome_pagetop").using(cx)) }
p { (L10n::l("welcome_issues1").using(cx)) }
p { (L10n::l("welcome_issues2").with_arg("app", app).using(cx)) }
}
.with_title(L10n::l("welcome_notice_title"))
.add_component(Html::with(move |cx| html! {
p { (L10n::l("welcome_notice_1").using(cx)) }
p { (L10n::l("welcome_notice_2").using(cx)) }
p { (L10n::l("welcome_notice_3").using(cx)) }
p { (L10n::l("welcome_notice_4").with_arg("app", app).using(cx)) }
})),
)
.render()

View file

@ -111,8 +111,8 @@ fn render_intro(page: &mut Page) -> Markup {
div class="intro-footer__links" {
a href="https://crates.io/crates/pagetop" target="_blank" rel="noreferrer" { ("Crates.io") }
a href="https://docs.rs/pagetop" target="_blank" rel="noreferrer" { ("Docs.rs") }
a href="https://git.cillero.es/manuelcillero/pagetop" target="_blank" rel="noreferrer" { (L10n::l("welcome_code").using(page)) }
em { (L10n::l("welcome_have_fun").using(page)) }
a href="https://git.cillero.es/manuelcillero/pagetop" target="_blank" rel="noreferrer" { (L10n::l("intro_code").using(page)) }
em { (L10n::l("intro_have_fun").using(page)) }
}
}
}

View file

@ -314,7 +314,7 @@ impl Context {
.ok_or_else(|| ErrorParam::TypeMismatch {
key,
expected: TypeInfo::FullName.of::<T>(),
saved: *type_name,
saved: type_name,
})
}

View file

@ -1,2 +1,6 @@
# Basic theme, intro layout.
intro_code = Code
intro_have_fun = Coding is creating
# PoweredBy component.
poweredby_pagetop = Powered by { $pagetop_link }

View file

@ -1,20 +1,21 @@
welcome_extension_name = Default homepage
welcome_extension_description = Displays a landing page when none is configured.
welcome_extension_name = Default Homepage
welcome_extension_description = Displays a default homepage when none is configured.
welcome_page = Welcome Page
welcome_title = Hello world!
welcome_page = Welcome page
welcome_title = Hello, world!
welcome_intro = Discover⚡{ $app }
welcome_powered = A web solution powered by <strong>PageTop!</strong>
welcome_powered = A web solution powered by <strong>PageTop</strong>
welcome_text1 = If you can read this page, it means that the <strong>PageTop</strong> server is running correctly but has not yet been fully configured. This usually means the site is either experiencing temporary issues or is undergoing routine maintenance.
welcome_text2 = If the issue persists, please <strong>contact your system administrator</strong> for assistance.
welcome_pagetop_label = PageTop version on Crates.io
welcome_release_label = Release date
welcome_license_label = License
welcome_about = About
welcome_pagetop = <strong>PageTop</strong> is a <a href="https://www.rust-lang.org" target="_blank">Rust</a>-based web development framework for building modular, extensible, and configurable web solutions.
welcome_text1 = PageTop is <strong>a Rust-based web development framework</strong> designed to build modular, extensible, and configurable web solutions.
welcome_text2 = PageTop brings back the essence of the classic web, renders on the server (SSR) and uses <em>HTML-first</em> components, CSS and JavaScript, <strong>with the performance and security of Rust</strong>.
welcome_issues1 = To report issues related to the <strong>PageTop</strong> framework, please use <a href="https://git.cillero.es/manuelcillero/pagetop/issues" target="_blank">SoloGit</a>. Before opening a new issue, check existing reports to avoid duplicates.
welcome_issues2 = For issues related specifically to <strong>{ $app }</strong>, please refer to its official repository or support channel, rather than directly to <strong>PageTop</strong>.
welcome_code = Code
welcome_have_fun = Coding is creating
welcome_notice_title = Notice
welcome_notice_1 = If you can see this page, the <strong>PageTop</strong> server is running correctly, but the application is not fully configured. This may be due to routine maintenance or a temporary issue.
welcome_notice_2 = If the issue persists, please <strong>contact the system administrator</strong>.
welcome_notice_3 = To report issues with the <strong>PageTop</strong> framework, use <a href="https://git.cillero.es/manuelcillero/pagetop/issues" target="_blank" rel="noreferrer">SoloGit</a>. Before opening a new issue, review the existing ones to avoid duplicates.
welcome_notice_4 = For issues specific to the application (<strong>{ $app }</strong>), please use its official repository or support channel.

View file

@ -1,2 +1,6 @@
# Basic theme, intro layout.
intro_code = Código
intro_have_fun = Programar es crear
# PoweredBy component.
poweredby_pagetop = Funciona con { $pagetop_link }

View file

@ -1,20 +1,21 @@
welcome_extension_name = Página de inicio predeterminada
welcome_extension_description = Muestra una página de inicio predeterminada cuando no hay ninguna configurada.
welcome_page = Página de Bienvenida
welcome_title = ¡Hola mundo!
welcome_page = Página de bienvenida
welcome_title = ¡Hola, mundo!
welcome_intro = Descubre⚡{ $app }
welcome_powered = Una solución web creada con <strong>PageTop!</strong>
welcome_powered = Una solución web creada con <strong>PageTop</strong>
welcome_text1 = Si puedes leer esta página, significa que el servidor de <strong>PageTop</strong> funciona correctamente, pero aún no ha sido completamente configurado. Esto suele indicar que el sitio está experimentando problemas temporales o está pasando por un mantenimiento de rutina.
welcome_text2 = Si el problema persiste, por favor <strong>contacta con el administrador del sistema</strong> para recibir asistencia técnica.
welcome_pagetop_label = Versión de PageTop en Crates.io
welcome_release_label = Lanzamiento
welcome_license_label = Licencia
welcome_about = Acerca de
welcome_pagetop = <strong>PageTop</strong> es un entorno de desarrollo web basado en <a href="https://www.rust-lang.org/es" target="_blank">Rust</a>, diseñado para crear soluciones web modulares, extensibles y configurables.
welcome_text1 = PageTop es un <strong>entorno de desarrollo web basado en Rust</strong>, pensado para construir soluciones web modulares, extensibles y configurables.
welcome_text2 = PageTop reivindica la esencia de la web clásica, renderiza en el servidor (SSR) utilizando componentes <em>HTML-first</em>, CSS y JavaScript, <strong>con el rendimiento y la seguridad de Rust</strong>.
welcome_issues1 = Para comunicar cualquier problema con <strong>PageTop</strong>, utiliza <a href="https://git.cillero.es/manuelcillero/pagetop/issues" target="_blank">SoloGit</a>. Antes de informar de una incidencia, revisa los informes ya existentes para evitar duplicados.
welcome_issues2 = Si se trata de fallos específicos de <strong>{ $app }</strong>, por favor acude a su repositorio oficial o canal de soporte, y no al de <strong>PageTop</strong> directamente.
welcome_code = Código
welcome_have_fun = Programar es crear
welcome_notice_title = Aviso
welcome_notice_1 = Si puedes ver esta página, el servidor de <strong>PageTop</strong> está funcionando correctamente, pero la aplicación no está completamente configurada. Esto puede deberse a tareas de mantenimiento o a una incidencia temporal.
welcome_notice_2 = Si el problema persiste, por favor, <strong>contacta con el administrador del sistema</strong>.
welcome_notice_3 = Para comunicar incidencias del propio entorno <strong>PageTop</strong>, utiliza <a href="https://git.cillero.es/manuelcillero/pagetop/issues" target="_blank" rel="noreferrer">SoloGit</a>. Antes de abrir una nueva incidencia, revisa las existentes para evitar duplicados.
welcome_notice_4 = Para fallos específicos de la aplicación (<strong>{ $app }</strong>), utiliza su repositorio oficial o su canal de soporte.