👽️ Apply last Handle API changes

This commit is contained in:
Manuel Cillero 2023-11-03 22:50:06 +01:00
parent 68c551bfb3
commit 088ffe7272
10 changed files with 37 additions and 63 deletions

View file

@ -1,14 +1,10 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(APP_DRUST);
struct Drust; struct Drust;
impl ModuleTrait for Drust { impl_handle!(APP_DRUST for Drust);
fn handle(&self) -> Handle {
APP_DRUST
}
impl ModuleTrait for Drust {
fn dependencies(&self) -> Vec<ModuleRef> { fn dependencies(&self) -> Vec<ModuleRef> {
vec![ vec![
// Themes. // Themes.

View file

@ -1,14 +1,10 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(APP_HELLO_NAME);
struct HelloName; struct HelloName;
impl ModuleTrait for HelloName { impl_handle!(APP_HELLO_NAME for HelloName);
fn handle(&self) -> Handle {
APP_HELLO_NAME
}
impl ModuleTrait for HelloName {
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) { fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
scfg.service(hello_name); scfg.service(hello_name);
} }

View file

@ -1,14 +1,10 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(APP_HELLO_WORLD);
struct HelloWorld; struct HelloWorld;
impl ModuleTrait for HelloWorld { impl_handle!(APP_HELLO_WORLD for HelloWorld);
fn handle(&self) -> Handle {
APP_HELLO_WORLD
}
impl ModuleTrait for HelloWorld {
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) { fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
scfg.route("/", service::web::get().to(hello_world)); scfg.route("/", service::web::get().to(hello_world));
} }

View file

@ -1,18 +1,14 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(MODULE_ADMIN);
new_static_locales!(LOCALES_ADMIN); new_static_locales!(LOCALES_ADMIN);
mod summary; mod summary;
pub struct Admin; pub struct Admin;
impl ModuleTrait for Admin { impl_handle!(MODULE_ADMIN for Admin);
fn handle(&self) -> Handle {
MODULE_ADMIN
}
impl ModuleTrait for Admin {
fn name(&self) -> L10n { fn name(&self) -> L10n {
L10n::t("module_name", &LOCALES_ADMIN) L10n::t("module_name", &LOCALES_ADMIN)
} }

View file

@ -1,18 +1,14 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(THEME_BOOTSIER);
new_static_locales!(LOCALES_BOOTSIER); new_static_locales!(LOCALES_BOOTSIER);
new_static_files!(bootsier); new_static_files!(bootsier);
pub struct Bootsier; pub struct Bootsier;
impl ModuleTrait for Bootsier { impl_handle!(THEME_BOOTSIER for Bootsier);
fn handle(&self) -> Handle {
THEME_BOOTSIER
}
impl ModuleTrait for Bootsier {
fn theme(&self) -> Option<ThemeRef> { fn theme(&self) -> Option<ThemeRef> {
Some(&Bootsier) Some(&Bootsier)
} }
@ -108,8 +104,8 @@ impl ThemeTrait for Bootsier {
_ => {} _ => {}
}; };
} }
COMPONENT_BASE_ANCHOR => { COMPONENT_BASE_BUTTON => {
let a = component_as_mut::<Anchor>(component); let a = component_as_mut::<Button>(component);
match a.font_size() { match a.font_size() {
FontSize::ExtraLarge => { FontSize::ExtraLarge => {
a.alter_classes(ClassesOp::Replace(a.font_size().to_string()), "fs-1"); a.alter_classes(ClassesOp::Replace(a.font_size().to_string()), "fs-1");
@ -128,6 +124,20 @@ impl ThemeTrait for Bootsier {
} }
_ => {} _ => {}
}; };
match a.anchor_type() {
ButtonType::Link => {
a.alter_classes(
ClassesOp::Replace(a.anchor_type().to_string()),
"btn btn-link",
);
}
ButtonType::Primary => {
a.alter_classes(
ClassesOp::Replace(a.anchor_type().to_string()),
"btn btn-primary",
);
}
}
} }
COMPONENT_BASE_HEADING => { COMPONENT_BASE_HEADING => {
let h = component_as_mut::<Heading>(component); let h = component_as_mut::<Heading>(component);

View file

@ -1,16 +1,12 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(THEME_BULMIX);
new_static_files!(bulmix); new_static_files!(bulmix);
pub struct Bulmix; pub struct Bulmix;
impl ModuleTrait for Bulmix { impl_handle!(THEME_BULMIX for Bulmix);
fn handle(&self) -> Handle {
THEME_BULMIX
}
impl ModuleTrait for Bulmix {
fn theme(&self) -> Option<ThemeRef> { fn theme(&self) -> Option<ThemeRef> {
Some(&Bulmix) Some(&Bulmix)
} }

View file

@ -1,18 +1,14 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(MODULE_HOMEDEMO);
new_static_locales!(LOCALES_HOMEDEMO); new_static_locales!(LOCALES_HOMEDEMO);
new_static_files!(homedemo); new_static_files!(homedemo);
pub struct HomeDemo; pub struct HomeDemo;
impl ModuleTrait for HomeDemo { impl_handle!(MODULE_HOMEDEMO for HomeDemo);
fn handle(&self) -> Handle {
MODULE_HOMEDEMO
}
impl ModuleTrait for HomeDemo {
fn name(&self) -> L10n { fn name(&self) -> L10n {
L10n::t("module_name", &LOCALES_HOMEDEMO) L10n::t("module_name", &LOCALES_HOMEDEMO)
} }

View file

@ -1,7 +1,5 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(MODULE_NODE);
new_static_locales!(LOCALES_NODE); new_static_locales!(LOCALES_NODE);
//mod entity; //mod entity;
@ -9,11 +7,9 @@ mod migration;
pub struct Node; pub struct Node;
impl ModuleTrait for Node { impl_handle!(MODULE_NODE for Node);
fn handle(&self) -> Handle {
MODULE_NODE
}
impl ModuleTrait for Node {
fn name(&self) -> L10n { fn name(&self) -> L10n {
L10n::t("module_name", &LOCALES_NODE) L10n::t("module_name", &LOCALES_NODE)
} }

View file

@ -1,18 +1,14 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(MODULE_USER);
new_static_locales!(LOCALES_USER); new_static_locales!(LOCALES_USER);
mod migration; mod migration;
pub struct User; pub struct User;
impl ModuleTrait for User { impl_handle!(MODULE_USER for User);
fn handle(&self) -> Handle {
MODULE_USER
}
impl ModuleTrait for User {
fn name(&self) -> L10n { fn name(&self) -> L10n {
L10n::t("module_name", &LOCALES_USER) L10n::t("module_name", &LOCALES_USER)
} }

View file

@ -1,14 +1,10 @@
use pagetop::prelude::*; use pagetop::prelude::*;
new_handle!(MODULE_TEST_SERVER_HEALTH_CHECK);
struct HealthCheck; struct HealthCheck;
impl ModuleTrait for HealthCheck { impl_handle!(MODULE_TEST_SERVER_HEALTH_CHECK for HealthCheck);
fn handle(&self) -> Handle {
MODULE_TEST_SERVER_HEALTH_CHECK impl ModuleTrait for HealthCheck {}
}
}
#[pagetop::test] #[pagetop::test]
async fn health_check_works() { async fn health_check_works() {