File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,11 @@ impl ModuleTrait for Admin {
18
18
}
19
19
20
20
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
+ ]
22
26
}
23
27
24
28
fn configure_service ( & self , scfg : & mut service:: web:: ServiceConfig ) {
@@ -31,3 +35,7 @@ impl ModuleTrait for Admin {
31
35
fn before_prepare_body ( page : & mut Page ) {
32
36
page. alter_body_classes ( ClassesOp :: Add , "test-admin" ) ;
33
37
}
38
+
39
+ fn before_prepare_menu ( component : & mut Menu , _cx : & mut Context ) {
40
+ component. alter_id ( "admin-menu-test-altered" ) ;
41
+ }
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ use pagetop::prelude::*;
4
4
5
5
pub async fn summary ( request : service:: HttpRequest ) -> ResultPage < Markup , FatalError > {
6
6
let top_menu = Menu :: new ( )
7
+ . with_id ( "admin-menu-test" )
7
8
. add_item ( menu:: Item :: label ( L10n :: t ( "module_name" , & LOCALES_ADMIN ) ) )
8
9
. add_item ( menu:: Item :: label ( L10n :: n ( "Ejemplo \" Label\" " ) ) )
9
10
. add_item ( menu:: Item :: link ( L10n :: n ( "Ejemplo \" Link\" " ) , |_| {
You can’t perform that action at this time.
0 commit comments