🦺 Include code to use the new API actions
This commit is contained in:
parent
23dc58c2ac
commit
7a68cf9be7
2 changed files with 10 additions and 1 deletions
|
|
@ -18,7 +18,11 @@ impl ModuleTrait for Admin {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn actions(&self) -> Vec<Action> {
|
fn actions(&self) -> Vec<Action> {
|
||||||
actions![action::page::BeforePrepareBody::with(before_prepare_body)]
|
actions![
|
||||||
|
action::page::BeforePrepareBody::with(before_prepare_body),
|
||||||
|
action::component::BeforePrepareComponent::<Menu>::with(before_prepare_menu)
|
||||||
|
.filtering_id("admin-menu-test"),
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||||
|
|
@ -31,3 +35,7 @@ impl ModuleTrait for Admin {
|
||||||
fn before_prepare_body(page: &mut Page) {
|
fn before_prepare_body(page: &mut Page) {
|
||||||
page.alter_body_classes(ClassesOp::Add, "test-admin");
|
page.alter_body_classes(ClassesOp::Add, "test-admin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn before_prepare_menu(component: &mut Menu, _cx: &mut Context) {
|
||||||
|
component.alter_id("admin-menu-test-altered");
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ use pagetop::prelude::*;
|
||||||
|
|
||||||
pub async fn summary(request: service::HttpRequest) -> ResultPage<Markup, FatalError> {
|
pub async fn summary(request: service::HttpRequest) -> ResultPage<Markup, FatalError> {
|
||||||
let top_menu = Menu::new()
|
let top_menu = Menu::new()
|
||||||
|
.with_id("admin-menu-test")
|
||||||
.add_item(menu::Item::label(L10n::t("module_name", &LOCALES_ADMIN)))
|
.add_item(menu::Item::label(L10n::t("module_name", &LOCALES_ADMIN)))
|
||||||
.add_item(menu::Item::label(L10n::n("Ejemplo \"Label\"")))
|
.add_item(menu::Item::label(L10n::n("Ejemplo \"Label\"")))
|
||||||
.add_item(menu::Item::link(L10n::n("Ejemplo \"Link\""), |_| {
|
.add_item(menu::Item::link(L10n::n("Ejemplo \"Link\""), |_| {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue