♻️ Define carpeta base para elementos integrados

This commit is contained in:
Manuel Cillero 2023-06-06 21:19:48 +02:00
parent 772546c164
commit cb735cf0fa
16 changed files with 24 additions and 18 deletions

3
pagetop/src/base.rs Normal file
View file

@ -0,0 +1,3 @@
pub mod component;
pub mod theme;

View file

@ -0,0 +1,2 @@
mod l10n;
pub use l10n::{L10n, COMPONENT_L10N};

View file

@ -1,9 +1,4 @@
use crate::core::component::{AnyComponent, ComponentTrait, RenderContext};
use crate::html::{html, Markup, PreEscaped};
use crate::locale::Locales;
use crate::{define_handle, fn_builder, Handle};
use fluent_templates::Loader;
use crate::prelude::*;
use std::collections::HashMap;

View file

@ -0,0 +1,2 @@
mod basic;
pub(crate) use basic::Basic;

View file

@ -11,6 +11,3 @@ pub mod module;
// API to add new layouts with themes.
pub mod theme;
// Basic theme.
pub(crate) mod basic;

View file

@ -18,6 +18,3 @@ pub(crate) use all::common_components;
mod renderable;
pub use renderable::{IsRenderable, Renderable};
mod l10n;
pub use l10n::{L10n, COMPONENT_L10N};

View file

@ -10,7 +10,7 @@ use std::str::FromStr;
static THEME: LazyStatic<ThemeStaticRef> =
LazyStatic::new(|| match theme_by_single_name(&config::SETTINGS.app.theme) {
Some(theme) => theme,
None => &crate::core::basic::Basic,
None => &crate::base::theme::Basic,
});
pub enum ContextOp {

View file

@ -28,7 +28,7 @@ pub fn register_modules(app: ModuleStaticRef) {
let mut list: Vec<ModuleStaticRef> = Vec::new();
// Enable basic theme.
add_to_enabled(&mut list, &crate::core::basic::Basic);
add_to_enabled(&mut list, &crate::base::theme::Basic);
// Enable application modules.
add_to_enabled(&mut list, app);

View file

@ -1,5 +1,5 @@
use crate::base::component::L10n;
use crate::core::action::Action;
use crate::core::component::L10n;
use crate::core::theme::ThemeStaticRef;
use crate::util::single_type_name;
use crate::{define_handle, server, Handle};

View file

@ -1,6 +1,7 @@
use crate::app::LOCALE_PAGETOP;
use crate::base::component::L10n;
use crate::config;
use crate::core::component::{ComponentTrait, L10n, RenderContext};
use crate::core::component::{ComponentTrait, RenderContext};
use crate::core::module::ModuleTrait;
use crate::html::{html, Favicon, Markup};
use crate::response::page::Page;

View file

@ -75,6 +75,9 @@ pub mod db;
// APIs esenciales para crear acciones, componentes, módulos y temas.
pub mod core;
// Acciones, componentes, módulos y temas integrados en PageTop.
pub mod base;
// API del servidor web.
pub mod server;

View file

@ -85,6 +85,7 @@ use crate::{args, config, trace, LazyStatic};
pub use fluent_templates;
pub(crate) use fluent_templates::Loader;
pub(crate) use fluent_templates::StaticLoader as Locales;
pub(crate) use unic_langid::{langid, LanguageIdentifier};

View file

@ -27,6 +27,8 @@ pub use crate::core::{action::*, component::*, module::*, theme::*};
pub use crate::{action, action_before_render_component};
pub use crate::base::component::*;
pub use crate::server;
pub use crate::server::HttpMessage;

View file

@ -3,7 +3,7 @@ pub use error403::ERROR_403;
mod error404;
pub use error404::ERROR_404;
use crate::core::component::L10n;
use crate::base::component::L10n;
use crate::response::{page::Page, ResponseError};
use crate::server::http::{header::ContentType, StatusCode};
use crate::server::{HttpRequest, HttpResponse};

View file

@ -1,5 +1,8 @@
use crate::base::component::L10n;
use crate::core::action::{action_ref, run_actions};
use crate::core::component::*;
use crate::core::component::{
common_components, ComponentTrait, ComponentsBundle, ContextOp, OneComponent, RenderContext,
};
use crate::html::{html, Classes, ClassesOp, Favicon, Markup, DOCTYPE};
use crate::locale::{langid_for, LanguageIdentifier};
use crate::response::fatal_error::FatalError;