🎉 [homedemo] Saca pág. demo de inicio de PageTop
This commit is contained in:
parent
c4aef7e2fa
commit
2134d4955b
18 changed files with 74 additions and 19 deletions
22
pagetop-homedemo/Cargo.toml
Normal file
22
pagetop-homedemo/Cargo.toml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
[package]
|
||||
name = "pagetop-homedemo"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
|
||||
authors = [
|
||||
"Manuel Cillero <manuel@cillero.es>"
|
||||
]
|
||||
description = """\
|
||||
Module that shows a demo home page to present PageTop.\
|
||||
"""
|
||||
homepage = "https://pagetop.cillero.es"
|
||||
repository = "https://github.com/manuelcillero/pagetop"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
|
||||
[dependencies]
|
||||
pagetop = { path = "../pagetop", version = "0.0" }
|
||||
static-files = "0.2.3"
|
||||
maud = "0.24.0"
|
||||
|
||||
[build-dependencies]
|
||||
pagetop-build = { path = "../pagetop-build", version = "0.0" }
|
||||
26
pagetop-homedemo/README.md
Normal file
26
pagetop-homedemo/README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
Módulo que muestra una página de inicio de demostración para presentar **PageTop**.
|
||||
|
||||
[PageTop](https://github.com/manuelcillero/pagetop/tree/main/pagetop), es un entorno de desarrollo
|
||||
basado en algunos de los *crates* más estables y populares del ecosistema Rust para proporcionar
|
||||
APIs, patrones de desarrollo y buenas prácticas para la creación de soluciones web SSR (*Server-Side
|
||||
Rendering*).
|
||||
|
||||
|
||||
# 🚧 Advertencia
|
||||
|
||||
**PageTop** sólo libera actualmente versiones de desarrollo. La API no es estable y los cambios son
|
||||
constantes. No puede considerarse preparado hasta que se libere la versión **0.1.0**.
|
||||
|
||||
|
||||
# 📜 Licencia
|
||||
|
||||
Este proyecto tiene licencia, de hecho tiene dos, puedes aplicar cualquiera de las siguientes a tu
|
||||
elección:
|
||||
|
||||
* Licencia Apache versión 2.0
|
||||
([LICENSE-APACHE](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-APACHE) o
|
||||
[http://www.apache.org/licenses/LICENSE-2.0]).
|
||||
|
||||
* Licencia MIT
|
||||
([LICENSE-MIT](https://github.com/manuelcillero/pagetop/blob/main/LICENSE-MIT) o
|
||||
[http://opensource.org/licenses/MIT]).
|
||||
3
pagetop-homedemo/build.rs
Normal file
3
pagetop-homedemo/build.rs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fn main() -> std::io::Result<()> {
|
||||
pagetop_build::bundle_resources("./static", "homedemo", None)
|
||||
}
|
||||
222
pagetop-homedemo/src/lib.rs
Normal file
222
pagetop-homedemo/src/lib.rs
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
use pagetop::prelude::*;
|
||||
|
||||
pub_handle!(MODULE_DEMOHOME);
|
||||
|
||||
pub_locale!("src/locales");
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/homedemo.rs"));
|
||||
|
||||
pub struct HomeDemo;
|
||||
|
||||
impl ModuleTrait for HomeDemo {
|
||||
fn handle(&self) -> Handle {
|
||||
MODULE_DEMOHOME
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
l("module_name")
|
||||
}
|
||||
|
||||
fn description(&self) -> Option<String> {
|
||||
Some(l("module_description"))
|
||||
}
|
||||
|
||||
fn configure_service(&self, cfg: &mut server::web::ServiceConfig) {
|
||||
serve_static_files!(cfg, "/homedemo", bundle_homedemo);
|
||||
cfg.route("/", server::web::get().to(demo));
|
||||
}
|
||||
}
|
||||
|
||||
async fn demo(request: server::HttpRequest) -> ResultPage<Markup, FatalError> {
|
||||
Page::new(request)
|
||||
.with_title(l("page_title").as_str())
|
||||
.with_context(ContextOp::AddStyleSheet(StyleSheet::located(
|
||||
"/homedemo/css/styles.css",
|
||||
)))
|
||||
.with_body_classes(ClassesOp::AddFirst, "default-homepage")
|
||||
.with_this_in("region-content", hello_world())
|
||||
.with_this_in("region-content", welcome())
|
||||
.with_this_in("region-content", about_pagetop())
|
||||
.with_this_in("region-content", promo_pagetop())
|
||||
.with_this_in("region-content", reporting_issues())
|
||||
.render()
|
||||
}
|
||||
|
||||
fn hello_world() -> Container {
|
||||
Container::header().with_id("hello-world").with_component(
|
||||
grid::Row::new()
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "hello-col-text")
|
||||
.with_size(grid::ColumnSize::Is5of12)
|
||||
.with_component(
|
||||
Heading::h1(html! {
|
||||
(l("page_title"))
|
||||
})
|
||||
.with_display(HeadingDisplay::Medium),
|
||||
)
|
||||
.with_component(
|
||||
Paragraph::with(html! {
|
||||
(e("hello_intro", &args![
|
||||
"app" => format!(
|
||||
"<span class=\"app-name\">{}</span>",
|
||||
&config::SETTINGS.app.name,
|
||||
)
|
||||
]))
|
||||
})
|
||||
.with_display(ParagraphDisplay::Small),
|
||||
)
|
||||
.with_component(Paragraph::with(html! {
|
||||
(e("hello_powered", &args![
|
||||
"pagetop" => format!(
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>",
|
||||
"https://pagetop.cillero.es",
|
||||
"PageTop",
|
||||
)
|
||||
]))
|
||||
}))
|
||||
.with_component(
|
||||
Anchor::button(
|
||||
"https://github.com/manuelcillero/pagetop",
|
||||
html! { (l("hello_code")) },
|
||||
)
|
||||
.with_target(AnchorTarget::Blank)
|
||||
.with_left_icon(Icon::with("git"))
|
||||
.with_classes(ClassesOp::Add, "code-link"),
|
||||
)
|
||||
.with_component(
|
||||
Anchor::link("#welcome", html! { (l("hello_welcome")) })
|
||||
.with_left_icon(Icon::with("arrow-down-circle-fill"))
|
||||
.with_classes(ClassesOp::Add, "welcome-link"),
|
||||
),
|
||||
)
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "hello-col-image")
|
||||
.with_component(Image::with("/homedemo/images/header.svg")),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn welcome() -> Container {
|
||||
Container::section()
|
||||
.with_id("welcome")
|
||||
.with_classes(ClassesOp::Add, "welcome-col-text")
|
||||
.with_component(Heading::h2(html! {
|
||||
(l("welcome_page"))
|
||||
}))
|
||||
.with_component(
|
||||
Heading::h3(html! {
|
||||
(e("welcome_subtitle", &args![
|
||||
"app" => format!(
|
||||
"<span class=\"app-name\">{}</span>",
|
||||
&config::SETTINGS.app.name
|
||||
)
|
||||
]))
|
||||
})
|
||||
.with_display(HeadingDisplay::Subtitle),
|
||||
)
|
||||
.with_component(
|
||||
Paragraph::with(html! {
|
||||
(l("welcome_text1"))
|
||||
})
|
||||
.with_display(ParagraphDisplay::Small),
|
||||
)
|
||||
.with_component(Paragraph::with(html! { (l("welcome_text2")) }))
|
||||
}
|
||||
|
||||
fn about_pagetop() -> Container {
|
||||
Container::new().with_id("pagetop").with_component(
|
||||
grid::Row::new()
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "pagetop-col-image")
|
||||
.with_size(grid::ColumnSize::Is5of12)
|
||||
.with_component(Image::with("/homedemo/images/about.svg")),
|
||||
)
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "pagetop-col-text")
|
||||
.with_component(Heading::h2(html! {
|
||||
(l("pagetop_title"))
|
||||
}))
|
||||
.with_component(
|
||||
Paragraph::with(html! {
|
||||
(l("pagetop_text1"))
|
||||
})
|
||||
.with_display(ParagraphDisplay::Small),
|
||||
)
|
||||
.with_component(Paragraph::with(html! {
|
||||
(l("pagetop_text2"))
|
||||
}))
|
||||
.with_component(Paragraph::with(html! {
|
||||
(e("pagetop_text3", &args![
|
||||
"pagetop_website" => format!(
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>",
|
||||
"https://docs.rs/pagetop/latest/pagetop",
|
||||
l("pagetop_website"),
|
||||
)
|
||||
]))
|
||||
})),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn promo_pagetop() -> Container {
|
||||
Container::new().with_id("promo").with_component(
|
||||
grid::Row::new()
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "promo-col-text")
|
||||
.with_component(Heading::h2(html! {
|
||||
(l("pagetop_promo_title"))
|
||||
}))
|
||||
.with_component(
|
||||
Paragraph::with(html! {
|
||||
(e("pagetop_promo_text1", &args![
|
||||
"pagetop" => format!(
|
||||
"<a href=\"{}\" target=\"_blank\">{}</a>",
|
||||
"https://crates.io/crates/pagetop",
|
||||
"PageTop",
|
||||
)
|
||||
]))
|
||||
})
|
||||
.with_display(ParagraphDisplay::Small),
|
||||
),
|
||||
)
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "promo-col-image")
|
||||
.with_size(grid::ColumnSize::Is6of12)
|
||||
.with_component(Image::with("/homedemo/images/pagetop.png")),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
fn reporting_issues() -> Container {
|
||||
Container::new().with_id("reporting").with_component(
|
||||
grid::Row::new()
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "reporting-col-image")
|
||||
.with_component(Image::with("/homedemo/images/support.jpg")),
|
||||
)
|
||||
.with_column(
|
||||
grid::Column::new()
|
||||
.with_classes(ClassesOp::Add, "reporting-col-text")
|
||||
.with_size(grid::ColumnSize::Is6of12)
|
||||
.with_component(Heading::h2(html! {
|
||||
(l("report_problems_title"))
|
||||
}))
|
||||
.with_component(
|
||||
Paragraph::with(html! {
|
||||
(l("report_problems_text1"))
|
||||
})
|
||||
.with_display(ParagraphDisplay::Small),
|
||||
)
|
||||
.with_component(Paragraph::with(html! {
|
||||
(l("report_problems_text2"))
|
||||
})),
|
||||
),
|
||||
)
|
||||
}
|
||||
27
pagetop-homedemo/src/locales/en-US/homepage.ftl
Normal file
27
pagetop-homedemo/src/locales/en-US/homepage.ftl
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
module_name = Default homepage
|
||||
module_description = Displays a demo homepage when none is configured.
|
||||
|
||||
page_title = Hello world!
|
||||
|
||||
hello_intro = This page is used to test the proper operation of { $app } after installation.
|
||||
hello_powered = This web solution is powered by { $pagetop }.
|
||||
hello_code = Code
|
||||
hello_welcome = Welcome
|
||||
|
||||
welcome_page = Welcome page
|
||||
welcome_subtitle = Are you user of { $app }?
|
||||
welcome_text1 = If you don't know what this page is about, this probably means that the site is either experiencing problems or is undergoing routine maintenance.
|
||||
welcome_text2 = If the problem persists, please contact your system administrator.
|
||||
|
||||
pagetop_title = About PageTop
|
||||
pagetop_text1 = If you can read this page, it means that the PageTop server is working properly, but has not yet been configured.
|
||||
pagetop_text2 = PageTop defines an interface for the most stable and popular Rust packages to build modular, extensible and configurable web solutions.
|
||||
pagetop_text3 = For more information on PageTop please visit the { $pagetop_website }.
|
||||
pagetop_website = technical documentation
|
||||
|
||||
pagetop_promo_title = Promoting PageTop
|
||||
pagetop_promo_text1 = You are free to use the image below on applications powered by { $pagetop }. Thanks for using PageTop!
|
||||
|
||||
report_problems_title = Reporting problems
|
||||
report_problems_text1 = Please use the GitHub tool to report bugs in PageTop. However, check "existing bug reports" before reporting a new bug.
|
||||
report_problems_text2 = Please report bugs specific to modules (such as admin, and others) to respective repositories, not to PageTop itself.
|
||||
27
pagetop-homedemo/src/locales/es-ES/homepage.ftl
Normal file
27
pagetop-homedemo/src/locales/es-ES/homepage.ftl
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
module_name = Página de inicio predeterminada
|
||||
module_description = Muestra una página de demostración predeterminada cuando no hay ninguna configurada.
|
||||
|
||||
page_title = ¡Hola mundo!
|
||||
|
||||
hello_intro = Esta página se utiliza para comprobar el correcto funcionamiento de { $app } después de la instalación.
|
||||
hello_powered = Esta solución web funciona con { $pagetop }.
|
||||
hello_code = Código
|
||||
hello_welcome = Bienvenida
|
||||
|
||||
welcome_page = Página de bienvenida
|
||||
welcome_subtitle = ¿Eres usuario de { $app }?
|
||||
welcome_text1 = Si no sabes de qué trata esta página, probablemente significa que el sitio está experimentando problemas o está pasando por un mantenimiento de rutina.
|
||||
welcome_text2 = Si el problema persiste, póngase en contacto con el administrador del sistema.
|
||||
|
||||
pagetop_title = Sobre PageTop
|
||||
pagetop_text1 = Si puedes leer esta página, significa que el servidor PageTop funciona correctamente, pero aún no se ha configurado.
|
||||
pagetop_text2 = PageTop define una interfaz para los paquetes Rust más estables y populares para crear soluciones web modulares, extensibles y configurables.
|
||||
pagetop_text3 = Para más información sobre PageTop, por favor visita la { $pagetop_website }.
|
||||
pagetop_website = documentación técnica
|
||||
|
||||
pagetop_promo_title = Promociona PageTop
|
||||
pagetop_promo_text1 = Eres libre de usar la siguiente imagen en aplicaciones desarrolladas con { $pagetop }. ¡Gracias por usar PageTop!
|
||||
|
||||
report_problems_title = Informando problemas
|
||||
report_problems_text1 = Utiliza la herramienta GitHub para informar errores en PageTop. Sin embargo, comprueba los "informes de errores existentes" antes de informar de un nuevo error.
|
||||
report_problems_text2 = Informa de errores específicos de los módulos (como admin y otros) en sus repositorios respectivos, no a PageTop en sí.
|
||||
103
pagetop-homedemo/static/css/styles.css
Normal file
103
pagetop-homedemo/static/css/styles.css
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
body.default-homepage span.app-name {
|
||||
font-weight: bold;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
#hello-world,
|
||||
#welcome,
|
||||
#pagetop,
|
||||
#promo,
|
||||
#reporting {
|
||||
padding: 2rem 5%;
|
||||
}
|
||||
|
||||
body.default-homepage [class$="-col-text"] {
|
||||
padding: 0 5%;
|
||||
text-align: center;
|
||||
}
|
||||
body.default-homepage [class$="-col-image"] {
|
||||
padding: 1rem 5%;
|
||||
}
|
||||
|
||||
#hello-world a {
|
||||
margin: .25rem;
|
||||
}
|
||||
#hello-world a.code-link {
|
||||
padding-left: 2rem;
|
||||
padding-right: 2rem;
|
||||
border-radius: 1.5rem;
|
||||
font-size: 1.125rem;
|
||||
}
|
||||
#hello-world a.welcome-link {
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#welcome > div.container {
|
||||
padding: 2rem 1rem;
|
||||
border-radius: 28px;
|
||||
background: url("/homedemo/images/welcome.jpg") center center no-repeat;
|
||||
background-size: auto;
|
||||
background-size: cover;
|
||||
color: #fff;
|
||||
}
|
||||
#welcome > div.container > h2 {
|
||||
color: #fff;
|
||||
}
|
||||
#welcome > div.container > h3 {
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
#reporting .reporting-col-image img {
|
||||
border-radius: 40px;
|
||||
}
|
||||
|
||||
/* Responsiveness */
|
||||
@media (min-width: 768px) {
|
||||
body.default-homepage [class$="-col-image"] {
|
||||
padding-top: 5%;
|
||||
}
|
||||
|
||||
#hello-world .hello-col-text {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
#hello-world .hello-col-image {
|
||||
padding-top: 3rem;
|
||||
}
|
||||
}
|
||||
@media (min-width: 992px) {
|
||||
body.default-homepage [class$="-col-image"] {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
#hello-world .hello-col-text {
|
||||
padding-top: 2rem;
|
||||
padding-left: 10%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#welcome {
|
||||
padding-left: 10%;
|
||||
padding-right: 10%;
|
||||
}
|
||||
#welcome > div.container {
|
||||
padding: 2rem 8rem;
|
||||
}
|
||||
|
||||
#pagetop .pagetop-col-text {
|
||||
padding-left: 2rem;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#promo .promo-col-text {
|
||||
padding-right: 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#reporting .reporting-col-text {
|
||||
padding-left: 1rem;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
1
pagetop-homedemo/static/images/about.svg
Normal file
1
pagetop-homedemo/static/images/about.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 33 KiB |
1
pagetop-homedemo/static/images/header.svg
Normal file
1
pagetop-homedemo/static/images/header.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 52 KiB |
BIN
pagetop-homedemo/static/images/pagetop.png
Normal file
BIN
pagetop-homedemo/static/images/pagetop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
BIN
pagetop-homedemo/static/images/support.jpg
Normal file
BIN
pagetop-homedemo/static/images/support.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
BIN
pagetop-homedemo/static/images/welcome.jpg
Normal file
BIN
pagetop-homedemo/static/images/welcome.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 21 KiB |
Loading…
Add table
Add a link
Reference in a new issue