🎉 [megamenu] Nuevo componente para PageTop
This commit is contained in:
parent
8ec2c698c8
commit
b02c729864
19 changed files with 184 additions and 105 deletions
|
|
@ -15,4 +15,6 @@ license = "Apache-2.0 OR MIT"
|
|||
|
||||
[dependencies]
|
||||
pagetop = { path = "../pagetop", version = "0.0" }
|
||||
pagetop-megamenu = { path = "../pagetop-megamenu", version = "0.0" }
|
||||
|
||||
maud = "0.24.0"
|
||||
|
|
|
|||
|
|
@ -21,15 +21,19 @@ impl ModuleTrait for Admin {
|
|||
Some(l("module_description"))
|
||||
}
|
||||
|
||||
fn configure_service(&self, cfg: &mut server::web::ServiceConfig) {
|
||||
cfg.service(
|
||||
server::web::scope("/admin").route("", server::web::get().to(summary::summary)),
|
||||
);
|
||||
fn dependencies(&self) -> Vec<ModuleStaticRef> {
|
||||
vec![&pagetop_megamenu::MegaMenu]
|
||||
}
|
||||
|
||||
fn actions(&self) -> Vec<HookAction> {
|
||||
vec![hook_action!(BeforeRenderPageHook => before_render_page)]
|
||||
}
|
||||
|
||||
fn configure_service(&self, cfg: &mut server::web::ServiceConfig) {
|
||||
cfg.service(
|
||||
server::web::scope("/admin").route("", server::web::get().to(summary::summary)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
fn before_render_page(page: &mut Page) {
|
||||
|
|
|
|||
|
|
@ -1,60 +1,58 @@
|
|||
//use super::l;
|
||||
use super::l;
|
||||
use pagetop::prelude::*;
|
||||
use pagetop_megamenu::component::{MegaMenu, MegaMenuItem};
|
||||
|
||||
pub async fn summary(request: server::HttpRequest) -> ResultPage<Markup, FatalError> {
|
||||
/*
|
||||
let top_menu = Menu::new()
|
||||
.with_item(MenuItem::label(l("module_name").as_str()))
|
||||
.with_item(MenuItem::link("Opción 2", "https://www.google.es"))
|
||||
.with_item(MenuItem::link_blank("Opción 3", "https://www.google.es"))
|
||||
.with_item(MenuItem::submenu(
|
||||
let top_menu = MegaMenu::new()
|
||||
.with_item(MegaMenuItem::label(l("module_name").as_str()))
|
||||
.with_item(MegaMenuItem::link("Opción 2", "https://www.google.es"))
|
||||
.with_item(MegaMenuItem::link_blank("Opción 3", "https://www.google.es"))
|
||||
.with_item(MegaMenuItem::submenu(
|
||||
"Submenú 1",
|
||||
Menu::new()
|
||||
.with_item(MenuItem::label("Opción 1"))
|
||||
.with_item(MenuItem::label("Opción 2")),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaMenuItem::label("Opción 1"))
|
||||
.with_item(MegaMenuItem::label("Opción 2")),
|
||||
))
|
||||
.with_item(MenuItem::separator())
|
||||
.with_item(MenuItem::submenu(
|
||||
.with_item(MegaMenuItem::separator())
|
||||
.with_item(MegaMenuItem::submenu(
|
||||
"Submenú 2",
|
||||
Menu::new()
|
||||
.with_item(MenuItem::label("Opción 1"))
|
||||
.with_item(MenuItem::label("Opción 2")),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaMenuItem::label("Opción 1"))
|
||||
.with_item(MegaMenuItem::label("Opción 2")),
|
||||
))
|
||||
.with_item(MenuItem::label("Opción 4"));
|
||||
.with_item(MegaMenuItem::label("Opción 4"));
|
||||
|
||||
let side_menu = Menu::new()
|
||||
.with_item(MenuItem::label("Opción 1"))
|
||||
.with_item(MenuItem::link("Opción 2", "https://www.google.es"))
|
||||
.with_item(MenuItem::link_blank("Opción 3", "https://www.google.es"))
|
||||
.with_item(MenuItem::submenu(
|
||||
let side_menu = MegaMenu::new()
|
||||
.with_item(MegaMenuItem::label("Opción 1"))
|
||||
.with_item(MegaMenuItem::link("Opción 2", "https://www.google.es"))
|
||||
.with_item(MegaMenuItem::link_blank("Opción 3", "https://www.google.es"))
|
||||
.with_item(MegaMenuItem::submenu(
|
||||
"Submenú 1",
|
||||
Menu::new()
|
||||
.with_item(MenuItem::label("Opción 1"))
|
||||
.with_item(MenuItem::label("Opción 2")),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaMenuItem::label("Opción 1"))
|
||||
.with_item(MegaMenuItem::label("Opción 2")),
|
||||
))
|
||||
.with_item(MenuItem::separator())
|
||||
.with_item(MenuItem::submenu(
|
||||
.with_item(MegaMenuItem::separator())
|
||||
.with_item(MegaMenuItem::submenu(
|
||||
"Submenú 2",
|
||||
Menu::new()
|
||||
.with_item(MenuItem::label("Opción 1"))
|
||||
.with_item(MenuItem::label("Opción 2")),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaMenuItem::label("Opción 1"))
|
||||
.with_item(MegaMenuItem::label("Opción 2")),
|
||||
))
|
||||
.with_item(MenuItem::label("Opción 4"));
|
||||
*/
|
||||
.with_item(MegaMenuItem::label("Opción 4"));
|
||||
|
||||
Page::new(request)
|
||||
.with_context(ContextOp::Theme("Bootsier"))
|
||||
.with_title("Admin")
|
||||
/* .with_this_in("top-menu", top_menu)
|
||||
.with_this_in(
|
||||
"region-content",
|
||||
grid::Row::new()
|
||||
.with_column(grid::Column::new().with_component(side_menu))
|
||||
.with_column(grid::Column::new().with_component(Html::with(html! {
|
||||
p { "Columna 2"}
|
||||
}))),
|
||||
)
|
||||
*/
|
||||
.with_this_in("top-menu", top_menu)
|
||||
.with_this_in(
|
||||
"region-content",
|
||||
grid::Row::new()
|
||||
.with_column(grid::Column::new().with_component(side_menu))
|
||||
.with_column(grid::Column::new().with_component(Html::with(html! {
|
||||
p { "Columna 2"}
|
||||
}))),
|
||||
)
|
||||
.with_template("admin")
|
||||
.render()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue