Modifica la forma de identificar temas y módulos
Cada módulo y cada tema requerirá a partir de ahora un identificador que debería ser único y con alguna sintaxis particular aún por definir (por ejemplo, admitiendo sólo minúsculas y sin espacios).
This commit is contained in:
parent
3764f707da
commit
83fd12b5cc
16 changed files with 65 additions and 30 deletions
|
|
@ -1,17 +0,0 @@
|
|||
use crate::prelude::*;
|
||||
use crate::base::module::admin::summary::summary;
|
||||
|
||||
pub struct AdminModule;
|
||||
|
||||
impl Module for AdminModule {
|
||||
fn name(&self) -> String {
|
||||
"PageTop Admin".to_string()
|
||||
}
|
||||
|
||||
fn configure_module(&self, cfg: &mut server::web::ServiceConfig) {
|
||||
cfg.service(
|
||||
server::web::scope("/admin")
|
||||
.route("", server::web::get().to(summary))
|
||||
);
|
||||
}
|
||||
}
|
||||
2
src/base/module/admin/locales/en-US/admin.ftl
Normal file
2
src/base/module/admin/locales/en-US/admin.ftl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module_name = Admin module
|
||||
module_desc = Administration module.
|
||||
2
src/base/module/admin/locales/es-ES/admin.ftl
Normal file
2
src/base/module/admin/locales/es-ES/admin.ftl
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
module_name = Admin module
|
||||
module_desc = Módulo de administración.
|
||||
|
|
@ -1,4 +1,28 @@
|
|||
mod configure;
|
||||
pub use configure::AdminModule;
|
||||
use crate::prelude::*;
|
||||
|
||||
localize!("en-US", "src/base/module/admin/locales");
|
||||
|
||||
mod summary;
|
||||
|
||||
pub struct AdminModule;
|
||||
|
||||
impl Module for AdminModule {
|
||||
fn id(&self) -> &'static str {
|
||||
"admin"
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
l("module_name")
|
||||
}
|
||||
|
||||
fn description(&self) -> String {
|
||||
l("module_desc")
|
||||
}
|
||||
|
||||
fn configure_module(&self, cfg: &mut server::web::ServiceConfig) {
|
||||
cfg.service(
|
||||
server::web::scope("/admin")
|
||||
.route("", server::web::get().to(summary::summary))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub async fn summary() -> server::Result<Markup> {
|
|||
|
||||
Page::prepare()
|
||||
|
||||
.using_theme(&bootsier::BootsierTheme)
|
||||
.using_theme("bootsier")
|
||||
|
||||
.with_title("Admin")
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ localize!("en-US", "src/base/module/homepage/locales");
|
|||
pub struct HomepageModule;
|
||||
|
||||
impl Module for HomepageModule {
|
||||
fn id(&self) -> &'static str {
|
||||
"homepage"
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
l("module_name")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ localize!("en-US", "src/base/module/user/locales");
|
|||
pub struct UserModule;
|
||||
|
||||
impl Module for UserModule {
|
||||
fn id(&self) -> &'static str {
|
||||
"user"
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
l("module_name")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,10 @@ include!(concat!(env!("OUT_DIR"), "/aliner.rs"));
|
|||
pub struct AlinerTheme;
|
||||
|
||||
impl Theme for AlinerTheme {
|
||||
fn id(&self) -> &'static str {
|
||||
"aliner"
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
"Aliner".to_string()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ localize!("en-US", "src/base/theme/bootsier/locales");
|
|||
pub struct BootsierTheme;
|
||||
|
||||
impl Theme for BootsierTheme {
|
||||
fn id(&self) -> &'static str {
|
||||
"bootsier"
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
"Bootsier".to_string()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@ use crate::prelude::*;
|
|||
pub struct MinimalTheme;
|
||||
|
||||
impl Theme for MinimalTheme {
|
||||
fn id(&self) -> &'static str {
|
||||
"minimal"
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
"Minimal".to_string()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue