🎉 [homedemo] Saca pág. demo de inicio de PageTop

This commit is contained in:
Manuel Cillero 2023-02-04 20:50:39 +01:00
parent c4aef7e2fa
commit 2134d4955b
18 changed files with 74 additions and 19 deletions

View file

@ -6,6 +6,7 @@ members = [
"pagetop-macros",
"pagetop-build",
"pagetop-jquery",
"pagetop-homedemo",
"pagetop-megamenu",
# Modules.
"pagetop-admin",

View file

@ -49,6 +49,9 @@ El repositorio se organiza en un *workspace* con los siguientes subproyectos:
* **[pagetop-megamenu](https://github.com/manuelcillero/pagetop/tree/main/pagetop-megamenu)**,
módulo que proporciona un nuevo componente para incluir menús avanzados en las soluciones web.
* **[pagetop-homedemo](https://github.com/manuelcillero/pagetop/tree/main/pagetop-homedemo)**,
módulo que muestra una página de inicio de demostración para presentar **PageTop**.
## Módulos
* **[pagetop-admin](https://github.com/manuelcillero/pagetop/tree/main/pagetop-admin)**, módulo que

View file

@ -17,6 +17,7 @@ license = "Apache-2.0 OR MIT"
actix-web = "4.2.1"
pagetop = { path = "../pagetop", version = "0.0", features = ["mysql"], default-features = false }
# Modules.
pagetop-homedemo = { path = "../pagetop-homedemo", version = "0.0" }
pagetop-admin = { path = "../pagetop-admin", version = "0.0" }
pagetop-user = { path = "../pagetop-user", version = "0.0" }
pagetop-node = { path = "../pagetop-node", version = "0.0" }

View file

@ -12,6 +12,7 @@ impl ModuleTrait for Drust {
fn dependencies(&self) -> Vec<ModuleStaticRef> {
vec![
// Modules.
&pagetop_homedemo::HomeDemo,
&pagetop_admin::Admin,
&pagetop_user::User,
&pagetop_node::Node,

View 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" }

View 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]).

View file

@ -0,0 +1,3 @@
fn main() -> std::io::Result<()> {
pagetop_build::bundle_resources("./static", "homedemo", None)
}

View file

@ -1,14 +1,16 @@
use crate::prelude::*;
use pagetop::prelude::*;
pub_handle!(MODULE_DEFAULT_HOMEPAGE);
pub_handle!(MODULE_DEMOHOME);
pub_locale!("src/base/module/homepage/locales");
pub_locale!("src/locales");
pub struct DefaultHomePage;
include!(concat!(env!("OUT_DIR"), "/homedemo.rs"));
impl ModuleTrait for DefaultHomePage {
pub struct HomeDemo;
impl ModuleTrait for HomeDemo {
fn handle(&self) -> Handle {
MODULE_DEFAULT_HOMEPAGE
MODULE_DEMOHOME
}
fn name(&self) -> String {
@ -20,6 +22,7 @@ impl ModuleTrait for DefaultHomePage {
}
fn configure_service(&self, cfg: &mut server::web::ServiceConfig) {
serve_static_files!(cfg, "/homedemo", bundle_homedemo);
cfg.route("/", server::web::get().to(demo));
}
}
@ -28,7 +31,7 @@ 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(
"/theme/module/homepage/styles.css",
"/homedemo/css/styles.css",
)))
.with_body_classes(ClassesOp::AddFirst, "default-homepage")
.with_this_in("region-content", hello_world())
@ -90,7 +93,7 @@ fn hello_world() -> Container {
.with_column(
grid::Column::new()
.with_classes(ClassesOp::Add, "hello-col-image")
.with_component(Image::with("/theme/images/homepage-header.svg")),
.with_component(Image::with("/homedemo/images/header.svg")),
),
)
}
@ -129,7 +132,7 @@ fn about_pagetop() -> Container {
grid::Column::new()
.with_classes(ClassesOp::Add, "pagetop-col-image")
.with_size(grid::ColumnSize::Is5of12)
.with_component(Image::with("/theme/images/homepage-about.svg")),
.with_component(Image::with("/homedemo/images/about.svg")),
)
.with_column(
grid::Column::new()
@ -185,7 +188,7 @@ fn promo_pagetop() -> Container {
grid::Column::new()
.with_classes(ClassesOp::Add, "promo-col-image")
.with_size(grid::ColumnSize::Is6of12)
.with_component(Image::with("/theme/images/homepage-pagetop.png")),
.with_component(Image::with("/homedemo/images/pagetop.png")),
),
)
}
@ -196,7 +199,7 @@ fn reporting_issues() -> Container {
.with_column(
grid::Column::new()
.with_classes(ClassesOp::Add, "reporting-col-image")
.with_component(Image::with("/theme/images/homepage-support.jpg")),
.with_component(Image::with("/homedemo/images/support.jpg")),
)
.with_column(
grid::Column::new()

View file

@ -37,7 +37,7 @@ body.default-homepage [class$="-col-image"] {
#welcome > div.container {
padding: 2rem 1rem;
border-radius: 28px;
background: url("/theme/images/homepage-welcome.jpg") center center no-repeat;
background: url("/homedemo/images/welcome.jpg") center center no-repeat;
background-size: auto;
background-size: cover;
color: #fff;

View file

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 81 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

View file

@ -1,5 +1,3 @@
pub mod saturn;
pub mod menu;
pub mod homepage;

View file

@ -46,16 +46,13 @@ pub fn register_modules(app: ModuleStaticRef) {
// List of modules to enable.
let mut list: Vec<ModuleStaticRef> = Vec::new();
// 1 of 3. Enable base modules.
// Enable base modules.
add_to_enabled(&mut list, &base::module::menu::Menu);
add_to_enabled(&mut list, &base::module::saturn::Saturn);
// 2 of 3. Enable application modules.
// Enable application modules.
add_to_enabled(&mut list, app);
// 3 of 3. Enable default homepage.
add_to_enabled(&mut list, &base::module::homepage::DefaultHomePage);
list.reverse();
ENABLED_MODULES.write().unwrap().append(&mut list);
}