🚧 Mejora la organización de base
This commit is contained in:
parent
a05355c4d1
commit
160dc034b4
22 changed files with 21 additions and 21 deletions
|
|
@ -30,7 +30,7 @@ impl ModuleTrait for Admin {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn actions(&self) -> Vec<Action> {
|
fn actions(&self) -> Vec<Action> {
|
||||||
vec![action!(actions::page::ActionBeforePreparePage => before_prepare_page)]
|
vec![action!(action::page::ActionBeforePreparePage => before_prepare_page)]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure_service(&self, cfg: &mut service::web::ServiceConfig) {
|
fn configure_service(&self, cfg: &mut service::web::ServiceConfig) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ impl ModuleTrait for JQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn actions(&self) -> Vec<Action> {
|
fn actions(&self) -> Vec<Action> {
|
||||||
vec![action!(actions::page::ActionBeforeRenderPage => before_render_page)]
|
vec![action!(action::page::ActionBeforeRenderPage => before_render_page)]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure_service(&self, cfg: &mut service::web::ServiceConfig) {
|
fn configure_service(&self, cfg: &mut service::web::ServiceConfig) {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl ModuleTrait for Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn actions(&self) -> Vec<Action> {
|
fn actions(&self) -> Vec<Action> {
|
||||||
vec![action!(actions::page::ActionBeforePreparePage => before_prepare_page, -1)]
|
vec![action!(action::page::ActionBeforePreparePage => before_prepare_page, -1)]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn migrations(&self) -> Vec<MigrationItem> {
|
fn migrations(&self) -> Vec<MigrationItem> {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
pub mod actions;
|
pub mod action;
|
||||||
|
|
||||||
pub mod components;
|
pub mod component;
|
||||||
|
|
||||||
pub mod themes;
|
pub mod theme;
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ impl ComponentTrait for Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
actions::block::run_actions_before_prepare_block(self, cx);
|
action::block::run_actions_before_prepare_block(self, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
|
|
@ -54,7 +54,7 @@ impl ComponentTrait for Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn after_prepare_component(&mut self, cx: &mut Context) {
|
fn after_prepare_component(&mut self, cx: &mut Context) {
|
||||||
actions::block::run_actions_after_prepare_block(self, cx);
|
action::block::run_actions_after_prepare_block(self, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn as_ref_any(&self) -> &dyn AnyComponent {
|
fn as_ref_any(&self) -> &dyn AnyComponent {
|
||||||
|
|
@ -28,7 +28,7 @@ pub fn register_modules(app: ModuleStaticRef) {
|
||||||
let mut list: Vec<ModuleStaticRef> = Vec::new();
|
let mut list: Vec<ModuleStaticRef> = Vec::new();
|
||||||
|
|
||||||
// Enable basic theme.
|
// Enable basic theme.
|
||||||
add_to_enabled(&mut list, &crate::base::themes::Basic);
|
add_to_enabled(&mut list, &crate::base::theme::Basic);
|
||||||
|
|
||||||
// Enable application modules.
|
// Enable application modules.
|
||||||
add_to_enabled(&mut list, app);
|
add_to_enabled(&mut list, app);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::base::components::L10n;
|
use crate::base::component::L10n;
|
||||||
use crate::core::action::Action;
|
use crate::core::action::Action;
|
||||||
use crate::core::theme::ThemeStaticRef;
|
use crate::core::theme::ThemeStaticRef;
|
||||||
use crate::{service, util, Handle};
|
use crate::{service, util, Handle};
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ pub static THEMES: LazyStatic<RwLock<Vec<ThemeStaticRef>>> =
|
||||||
pub static THEME: LazyStatic<ThemeStaticRef> =
|
pub static THEME: LazyStatic<ThemeStaticRef> =
|
||||||
LazyStatic::new(|| match theme_by_single_name(&config::SETTINGS.app.theme) {
|
LazyStatic::new(|| match theme_by_single_name(&config::SETTINGS.app.theme) {
|
||||||
Some(theme) => theme,
|
Some(theme) => theme,
|
||||||
None => &crate::base::themes::Basic,
|
None => &crate::base::theme::Basic,
|
||||||
});
|
});
|
||||||
|
|
||||||
// THEME BY NAME ***********************************************************************************
|
// THEME BY NAME ***********************************************************************************
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use crate::base::components::L10n;
|
use crate::base::component::L10n;
|
||||||
use crate::core::component::{ComponentTrait, Context};
|
use crate::core::component::{ComponentTrait, Context};
|
||||||
use crate::core::module::ModuleTrait;
|
use crate::core::module::ModuleTrait;
|
||||||
use crate::html::{html, Favicon, Markup};
|
use crate::html::{html, Favicon, Markup};
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
//! use_locale!(LOCALE_SAMPLE["path/to/locale"]);
|
//! use_locale!(LOCALE_SAMPLE["path/to/locale"]);
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! Usa el componente [L10n](crate::base::components::L10n) para incluir textos y contenidos
|
//! Usa el componente [L10n](crate::base::component::L10n) para incluir textos y contenidos
|
||||||
//! opcionalmente traducibles según el contexto de renderizado.
|
//! opcionalmente traducibles según el contexto de renderizado.
|
||||||
|
|
||||||
use crate::{config, kv, trace, LazyStatic};
|
use crate::{config, kv, trace, LazyStatic};
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,9 @@ pub use crate::{db, db::*, migration_item, pub_migration};
|
||||||
|
|
||||||
pub use crate::core::{action::*, component::*, module::*, theme::*};
|
pub use crate::core::{action::*, component::*, module::*, theme::*};
|
||||||
|
|
||||||
pub use crate::base::actions;
|
pub use crate::base::action;
|
||||||
pub use crate::base::components::*;
|
pub use crate::base::component::*;
|
||||||
pub use crate::base::themes;
|
pub use crate::base::theme;
|
||||||
|
|
||||||
pub use crate::service;
|
pub use crate::service;
|
||||||
pub use crate::service::HttpMessage;
|
pub use crate::service::HttpMessage;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ pub use error403::ERROR_403;
|
||||||
mod error404;
|
mod error404;
|
||||||
pub use error404::ERROR_404;
|
pub use error404::ERROR_404;
|
||||||
|
|
||||||
use crate::base::components::L10n;
|
use crate::base::component::L10n;
|
||||||
use crate::response::{page::Page, ResponseError};
|
use crate::response::{page::Page, ResponseError};
|
||||||
use crate::service::http::{header::ContentType, StatusCode};
|
use crate::service::http::{header::ContentType, StatusCode};
|
||||||
use crate::service::{HttpRequest, HttpResponse};
|
use crate::service::{HttpRequest, HttpResponse};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::base::actions;
|
use crate::base::action;
|
||||||
use crate::base::components::L10n;
|
use crate::base::component::L10n;
|
||||||
use crate::core::component::{ComponentTrait, Context, ContextOp, OneComponent};
|
use crate::core::component::{ComponentTrait, Context, ContextOp, OneComponent};
|
||||||
use crate::core::theme::ComponentsRegions;
|
use crate::core::theme::ComponentsRegions;
|
||||||
use crate::html::{html, Classes, ClassesOp, Favicon, Markup, DOCTYPE};
|
use crate::html::{html, Classes, ClassesOp, Favicon, Markup, DOCTYPE};
|
||||||
|
|
@ -136,7 +136,7 @@ impl Page {
|
||||||
|
|
||||||
pub fn render(&mut self) -> ResultPage<Markup, FatalError> {
|
pub fn render(&mut self) -> ResultPage<Markup, FatalError> {
|
||||||
// Module actions before preparing the page.
|
// Module actions before preparing the page.
|
||||||
actions::page::run_actions_before_prepare_page(self);
|
action::page::run_actions_before_prepare_page(self);
|
||||||
|
|
||||||
// Theme actions before preparing the page.
|
// Theme actions before preparing the page.
|
||||||
self.context.theme().before_prepare_page(self);
|
self.context.theme().before_prepare_page(self);
|
||||||
|
|
@ -145,7 +145,7 @@ impl Page {
|
||||||
let body = self.context.theme().prepare_page_body(self);
|
let body = self.context.theme().prepare_page_body(self);
|
||||||
|
|
||||||
// Module actions before rendering the page.
|
// Module actions before rendering the page.
|
||||||
actions::page::run_actions_before_render_page(self);
|
action::page::run_actions_before_render_page(self);
|
||||||
|
|
||||||
// Theme actions before rendering the page.
|
// Theme actions before rendering the page.
|
||||||
self.context.theme().before_render_page(self);
|
self.context.theme().before_render_page(self);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue