Skip to content

Commit 7a68cf9

Browse files
committed
🦺 Include code to use the new API actions
1 parent 23dc58c commit 7a68cf9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pagetop-admin/src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ impl ModuleTrait for Admin {
1818
}
1919

2020
fn actions(&self) -> Vec<Action> {
21-
actions![action::page::BeforePrepareBody::with(before_prepare_body)]
21+
actions![
22+
action::page::BeforePrepareBody::with(before_prepare_body),
23+
action::component::BeforePrepareComponent::<Menu>::with(before_prepare_menu)
24+
.filtering_id("admin-menu-test"),
25+
]
2226
}
2327

2428
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
@@ -31,3 +35,7 @@ impl ModuleTrait for Admin {
3135
fn before_prepare_body(page: &mut Page) {
3236
page.alter_body_classes(ClassesOp::Add, "test-admin");
3337
}
38+
39+
fn before_prepare_menu(component: &mut Menu, _cx: &mut Context) {
40+
component.alter_id("admin-menu-test-altered");
41+
}

pagetop-admin/src/summary.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use pagetop::prelude::*;
44

55
pub async fn summary(request: service::HttpRequest) -> ResultPage<Markup, FatalError> {
66
let top_menu = Menu::new()
7+
.with_id("admin-menu-test")
78
.add_item(menu::Item::label(L10n::t("module_name", &LOCALES_ADMIN)))
89
.add_item(menu::Item::label(L10n::n("Ejemplo \"Label\"")))
910
.add_item(menu::Item::link(L10n::n("Ejemplo \"Link\""), |_| {

0 commit comments

Comments
 (0)