👽️ 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::*;
new_handle!(APP_DRUST);
struct Drust;
impl ModuleTrait for Drust {
fn handle(&self) -> Handle {
APP_DRUST
}
impl_handle!(APP_DRUST for Drust);
impl ModuleTrait for Drust {
fn dependencies(&self) -> Vec<ModuleRef> {
vec![
// Themes.

View file

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

View file

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

View file

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

View file

@ -1,18 +1,14 @@
use pagetop::prelude::*;
new_handle!(THEME_BOOTSIER);
new_static_locales!(LOCALES_BOOTSIER);
new_static_files!(bootsier);
pub struct Bootsier;
impl ModuleTrait for Bootsier {
fn handle(&self) -> Handle {
THEME_BOOTSIER
}
impl_handle!(THEME_BOOTSIER for Bootsier);
impl ModuleTrait for Bootsier {
fn theme(&self) -> Option<ThemeRef> {
Some(&Bootsier)
}
@ -108,8 +104,8 @@ impl ThemeTrait for Bootsier {
_ => {}
};
}
COMPONENT_BASE_ANCHOR => {
let a = component_as_mut::<Anchor>(component);
COMPONENT_BASE_BUTTON => {
let a = component_as_mut::<Button>(component);
match a.font_size() {
FontSize::ExtraLarge => {
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 => {
let h = component_as_mut::<Heading>(component);

View file

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

View file

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

View file

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

View file

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

View file

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