Añade nuevo proyecto para el sitio web de PageTop

This commit is contained in:
Manuel Cillero 2022-07-19 19:24:56 +02:00
parent 57fd4c2054
commit 686ec924d1
14 changed files with 57 additions and 20 deletions

5
.gitignore vendored
View file

@ -1,4 +1,5 @@
workdir
**/target
**/log/*.log
**/log/*.log*
**/update.sh
Cargo.lock
workdir

View file

@ -5,4 +5,5 @@ members = [
"pagetop-admin",
"pagetop-user",
"pagetop-node",
"website",
]

View file

@ -8,13 +8,6 @@ impl AppTrait for Drust {
&pagetop_admin::Admin,
&pagetop_user::User,
&pagetop_node::Node,
&pagetop::base::module::demopage::Demopage,
]
}
fn themes(&self) -> Vec<&'static dyn ThemeTrait> {
vec![
&pagetop::base::theme::bulmix::Bulmix,
]
}
}

View file

@ -25,6 +25,10 @@ impl Application {
#[cfg(any(feature = "mysql", feature = "postgres", feature = "sqlite"))]
Lazy::force(&super::db::DBCONN);
// Habilita los módulos predeterminados.
module::all::enable_modules(vec![
&base::module::homepage::DefaultHomePage,
]);
// Habilita los módulos de la aplicación.
module::all::enable_modules(app.enable_modules());
@ -33,6 +37,7 @@ impl Application {
&base::theme::aliner::Aliner,
&base::theme::minimal::Minimal,
&base::theme::bootsier::Bootsier,
&base::theme::bulmix::Bulmix,
]);
// Registra los temas de la aplicación.
theme::all::register_themes(app.themes());

View file

@ -1,4 +1,3 @@
use crate::base::module::demopage;
use crate::core::module::ModuleTrait;
use crate::core::theme::ThemeTrait;
@ -7,9 +6,7 @@ pub trait AppTrait: Send + Sync {
}
fn enable_modules(&self) -> Vec<&'static dyn ModuleTrait> {
vec![
&demopage::Demopage,
]
vec![]
}
fn disable_modules(&self) -> Vec<&'static dyn ModuleTrait> {

View file

@ -1 +1 @@
pub mod demopage;
pub mod homepage;

View file

@ -1,14 +1,14 @@
use crate::prelude::*;
pub const MODULE_DEMOPAGE: &str = "pagetop::module::demopage";
pub const MODULE_DEFAULT_HOMEPAGE: &str = "pagetop::module::homepage::default";
localize!("src/base/module/demopage/locales");
localize!("src/base/module/homepage/locales");
pub struct Demopage;
pub struct DefaultHomePage;
impl ModuleTrait for Demopage {
impl ModuleTrait for DefaultHomePage {
fn handler(&self) -> &'static str {
MODULE_DEMOPAGE
MODULE_DEFAULT_HOMEPAGE
}
fn name(&self) -> String {
@ -28,7 +28,7 @@ async fn demo() -> app::Result<Markup> {
Page::new()
.with_title(l("page_title").as_str())
.with_context(InContextOp::StyleSheet(AssetsOp::Add(
StyleSheet::located("/theme/module/demopage/styles.css")
StyleSheet::located("/theme/module/homepage/styles.css")
)))
.add_to("content", hello_world())
.add_to("content", welcome())

20
website/Cargo.toml Normal file
View file

@ -0,0 +1,20 @@
[package]
name = "pagetop-website"
version = "0.0.1"
edition = "2021"
authors = [
"Manuel Cillero <manuel@cillero.es>"
]
description = """\
PageTop and Drust website.\
"""
homepage = "https://pagetop.cillero.es"
repository = "https://gitlab.com/manuelcillero/pagetop/website"
license = "Apache-2.0 or MIT"
[dependencies.pagetop]
path = "../pagetop"
[dependencies]
actix-web = "4.1.0"

View file

@ -0,0 +1,9 @@
[app]
name = "PageTop WebSite"
description = """\
The definitive PageTop Guide for PageTop Users.\
"""
language = "es-ES"
[log]
rolling = "Daily"

11
website/src/main.rs Normal file
View file

@ -0,0 +1,11 @@
use pagetop::prelude::*;
struct PageTopWebSite;
impl AppTrait for PageTopWebSite {
}
#[actix_web::main]
async fn main() -> std::io::Result<()> {
Application::prepare(PageTopWebSite).await?.run()?.await
}