♻️ Major refactor for improved base asset use
This commit is contained in:
parent
c2ea399635
commit
2015bb77f0
34 changed files with 244 additions and 1863 deletions
|
|
@ -16,4 +16,3 @@ license = "Apache-2.0 OR MIT"
|
|||
|
||||
[dependencies]
|
||||
pagetop = { version = "0.0", path = "../pagetop" }
|
||||
pagetop-megamenu = { version = "0.0", path = "../pagetop-megamenu" }
|
||||
|
|
|
|||
|
|
@ -21,13 +21,6 @@ impl ModuleTrait for Admin {
|
|||
L10n::t("module_description", &LOCALES_ADMIN)
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn dependencies(&self) -> Vec<ModuleRef> {
|
||||
vec![
|
||||
&pagetop_megamenu::MegaMenu,
|
||||
]
|
||||
}
|
||||
|
||||
fn actions(&self) -> Vec<Action> {
|
||||
actions![action::page::BeforePrepareBody::with(before_prepare_body)]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +1,167 @@
|
|||
use crate::LOCALES_ADMIN;
|
||||
|
||||
use pagetop::prelude::*;
|
||||
use pagetop_megamenu::component::{MegaItem, MegaMenu};
|
||||
|
||||
pub async fn summary(request: service::HttpRequest) -> ResultPage<Markup, FatalError> {
|
||||
let top_menu = MegaMenu::new()
|
||||
.with_item(MegaItem::label(L10n::t("module_name", &LOCALES_ADMIN)))
|
||||
.with_item(MegaItem::link(L10n::n("Opción 2"), |_| {
|
||||
let top_menu = Menu::new()
|
||||
.with_item(menu::Item::label(L10n::t("module_name", &LOCALES_ADMIN)))
|
||||
.with_item(menu::Item::label(L10n::n("Ejemplo \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Ejemplo \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(MegaItem::link_blank(L10n::n("Opción 3"), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(MegaItem::submenu(
|
||||
L10n::n("Submenú 1"),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaItem::label(L10n::n("Opción 1")))
|
||||
.with_item(MegaItem::label(L10n::n("Opción 2"))),
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Ejemplo \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
))
|
||||
.with_item(MegaItem::separator())
|
||||
.with_item(MegaItem::submenu(
|
||||
L10n::n("Submenú 2"),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaItem::label(L10n::n("Opción 1")))
|
||||
.with_item(MegaItem::label(L10n::n("Opción 2"))),
|
||||
.with_item(menu::Item::submenu(
|
||||
L10n::n("Ejemplo Submenú"),
|
||||
menu::Submenu::new()
|
||||
.with_title(L10n::n("Título submenú"))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
))
|
||||
.with_item(menu::Item::submenu(
|
||||
L10n::n("Otro submenú con un texto muy, pero que muy largo"),
|
||||
menu::Submenu::new()
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\""))),
|
||||
))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\""))),
|
||||
))
|
||||
.with_item(MegaItem::label(L10n::n("Opción 4")));
|
||||
.with_item(menu::Item::megamenu(
|
||||
L10n::n("Ejemplo Megamenú 1"),
|
||||
menu::Megamenu::new()
|
||||
.with_group(
|
||||
menu::Group::new()
|
||||
.with_element(menu::Element::submenu(
|
||||
menu::Submenu::new()
|
||||
.with_title(L10n::n("Título submenú"))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
)),
|
||||
))
|
||||
.with_element(menu::Element::submenu(
|
||||
menu::Submenu::new()
|
||||
.with_title(L10n::n("Título submenú"))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
)),
|
||||
)),
|
||||
)
|
||||
.with_group(
|
||||
menu::Group::new().with_element(menu::Element::submenu(
|
||||
menu::Submenu::new()
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\""))),
|
||||
)),
|
||||
)
|
||||
.with_group(
|
||||
menu::Group::new()
|
||||
.with_element(menu::Element::submenu(
|
||||
menu::Submenu::new()
|
||||
.with_title(L10n::n("Título submenú"))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
)),
|
||||
))
|
||||
.with_element(menu::Element::submenu(
|
||||
menu::Submenu::new()
|
||||
.with_title(L10n::n("Título submenú"))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
)),
|
||||
)),
|
||||
)
|
||||
.with_group(
|
||||
menu::Group::new().with_element(menu::Element::submenu(
|
||||
menu::Submenu::new()
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\"")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción \"Link\""), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(menu::Item::link_blank(
|
||||
L10n::n("Opción \"LinkBlank\""),
|
||||
|_| "https://www.google.es",
|
||||
))
|
||||
.with_item(menu::Item::label(L10n::n("Opción \"Label\""))),
|
||||
)),
|
||||
),
|
||||
));
|
||||
|
||||
let side_menu = MegaMenu::new()
|
||||
.with_item(MegaItem::label(L10n::n("Opción 1")))
|
||||
.with_item(MegaItem::link(L10n::n("Opción 2"), |_| {
|
||||
let side_menu = Menu::new()
|
||||
.with_item(menu::Item::label(L10n::n("Opción 1")))
|
||||
.with_item(menu::Item::link(L10n::n("Opción 2"), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(MegaItem::link_blank(L10n::n("Opción 3"), |_| {
|
||||
.with_item(menu::Item::link_blank(L10n::n("Opción 3"), |_| {
|
||||
"https://www.google.es"
|
||||
}))
|
||||
.with_item(MegaItem::submenu(
|
||||
.with_item(menu::Item::submenu(
|
||||
L10n::n("Submenú 1"),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaItem::label(L10n::n("Opción 1")))
|
||||
.with_item(MegaItem::label(L10n::n("Opción 2"))),
|
||||
))
|
||||
.with_item(MegaItem::separator())
|
||||
.with_item(MegaItem::submenu(
|
||||
menu::Submenu::new()
|
||||
.with_item(menu::Item::label(L10n::n("Opción 1")))
|
||||
.with_item(menu::Item::label(L10n::n("Opción 2"))),
|
||||
)) /*
|
||||
.with_item(menu::Item::separator()) */
|
||||
.with_item(menu::Item::submenu(
|
||||
L10n::n("Submenú 2"),
|
||||
MegaMenu::new()
|
||||
.with_item(MegaItem::label(L10n::n("Opción 1")))
|
||||
.with_item(MegaItem::label(L10n::n("Opción 2"))),
|
||||
menu::Submenu::new()
|
||||
.with_item(menu::Item::label(L10n::n("Opción 1")))
|
||||
.with_item(menu::Item::label(L10n::n("Opción 2"))),
|
||||
))
|
||||
.with_item(MegaItem::label(L10n::n("Opción 4")));
|
||||
.with_item(menu::Item::label(L10n::n("Opción 4")));
|
||||
|
||||
Page::new(request)
|
||||
.with_context(ContextOp::Theme("Bootsier"))
|
||||
//.with_context(ContextOp::Theme("Bootsier"))
|
||||
.with_title(L10n::n("Admin"))
|
||||
.with_in("top-menu", top_menu)
|
||||
.with_in("top-menu", side_menu)
|
||||
.with_in(
|
||||
"content",
|
||||
flex::Container::new()
|
||||
.with_item(flex::Item::new().with_component(side_menu))
|
||||
.with_item(flex::Item::new().with_component(Html::with(html! {
|
||||
p { "Columna 2"}
|
||||
p { "Columna 1"}
|
||||
})))
|
||||
.with_item(flex::Item::new().with_component(top_menu))
|
||||
.with_item(flex::Item::new().with_component(Html::with(html! {
|
||||
p { "Columna 3"}
|
||||
}))),
|
||||
)
|
||||
.with_template("admin")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue