🚧 [website] Sitio en español por defecto
This commit is contained in:
parent
7e5965176b
commit
352454789f
2 changed files with 49 additions and 69 deletions
|
|
@ -2,6 +2,7 @@
|
|||
name = "PageTop"
|
||||
description = "An opinionated web framework to build modular Server-Side Rendering web solutions."
|
||||
theme = "Bootsier"
|
||||
language = "es"
|
||||
|
||||
[bootsier]
|
||||
max_width = "1520px"
|
||||
|
|
|
|||
|
|
@ -27,20 +27,20 @@ impl PackageTrait for PageTopWebSite {
|
|||
}
|
||||
|
||||
fn init(&self) {
|
||||
let nav = Navbar::new().with_nav(TypedOp::Add(Typed::with(
|
||||
let nav = Navbar::with_nav(
|
||||
navbar::Nav::new()
|
||||
.with_item(navbar::Item::link(
|
||||
L10n::t("menu_home", &LOCALES_WEBSITE),
|
||||
|cx| match cx.langid().language.as_str() {
|
||||
"es" => "/es",
|
||||
"en" => "/en",
|
||||
_ => "/",
|
||||
},
|
||||
))
|
||||
.with_item(navbar::Item::link(
|
||||
L10n::t("menu_documentation", &LOCALES_WEBSITE),
|
||||
|cx| match cx.langid().language.as_str() {
|
||||
"es" => "/doc/latest/es",
|
||||
_ => "/doc/latest/en",
|
||||
"en" => "/doc/latest/en",
|
||||
_ => "/doc/latest/es",
|
||||
},
|
||||
))
|
||||
.with_item(navbar::Item::link_blank(
|
||||
|
|
@ -50,74 +50,53 @@ impl PackageTrait for PageTopWebSite {
|
|||
.with_item(navbar::Item::link_blank(
|
||||
L10n::t("menu_code", &LOCALES_WEBSITE),
|
||||
|_| "https://github.com/manuelcillero/pagetop",
|
||||
)),
|
||||
)));
|
||||
)), /*
|
||||
.with_item(navbar::Item::html(Html::with(html! {
|
||||
select id="select-lang" {
|
||||
option value="en" { "EN" }
|
||||
option value="es" { "ES" }
|
||||
}
|
||||
script {
|
||||
r###"
|
||||
var selectLang=document.getElementById('select-lang');
|
||||
selectLang.value=document.documentElement.lang;
|
||||
selectLang.addEventListener('change',function(){window.location.href='/'+selectLang.value;});
|
||||
"###
|
||||
}
|
||||
})) */
|
||||
)
|
||||
.with_id("main-menu")
|
||||
.with_expand(BreakPoint::LG);
|
||||
|
||||
InRegion::Content.add(Child::with(nav));
|
||||
|
||||
/*
|
||||
let branding = Branding::new()
|
||||
.with_logo(Some(Image::pagetop()))
|
||||
.with_slogan(L10n::t("app_slogan", &LOCALES_WEBSITE))
|
||||
.with_frontpage(|cx| match cx.langid().language.as_str() {
|
||||
"es" => "/es",
|
||||
_ => "/",
|
||||
});
|
||||
let menu = Menu::new()
|
||||
.add_item(menu::Item::link(
|
||||
L10n::t("menu_home", &LOCALES_WEBSITE),
|
||||
|cx| match cx.langid().language.as_str() {
|
||||
"es" => "/es",
|
||||
_ => "/",
|
||||
},
|
||||
))
|
||||
.add_item(menu::Item::link(
|
||||
L10n::t("menu_documentation", &LOCALES_WEBSITE),
|
||||
|cx| match cx.langid().language.as_str() {
|
||||
"es" => "/doc/latest/es",
|
||||
_ => "/doc/latest/en",
|
||||
},
|
||||
))
|
||||
.add_item(menu::Item::link_blank(
|
||||
L10n::t("menu_api", &LOCALES_WEBSITE),
|
||||
|_| "https://docs.rs/pagetop",
|
||||
))
|
||||
.add_item(menu::Item::link_blank(
|
||||
L10n::t("menu_code", &LOCALES_WEBSITE),
|
||||
|_| "https://github.com/manuelcillero/pagetop",
|
||||
))
|
||||
.add_item(menu::Item::html(Html::with(html! {
|
||||
select id="select-lang" {
|
||||
option value="en" { "EN" }
|
||||
option value="es" { "ES" }
|
||||
}
|
||||
script {
|
||||
r###"
|
||||
var selectLang=document.getElementById('select-lang');
|
||||
selectLang.value=document.documentElement.lang;
|
||||
selectLang.addEventListener('change',function(){window.location.href='/'+selectLang.value;});
|
||||
"###
|
||||
}
|
||||
})));
|
||||
let branding = Branding::new()
|
||||
.with_logo(Some(Image::pagetop()))
|
||||
.with_slogan(L10n::t("app_slogan", &LOCALES_WEBSITE))
|
||||
.with_frontpage(|cx| match cx.langid().language.as_str() {
|
||||
"es" => "/es",
|
||||
_ => "/",
|
||||
});
|
||||
|
||||
InRegion::Named("header").add(AnyComponent::with(
|
||||
flex::Container::new()
|
||||
.with_direction(flex::Direction::Row(BreakPoint::None))
|
||||
.with_justify(flex::Justify::SpaceBetween)
|
||||
.with_align(flex::Align::End)
|
||||
.add_item(flex::Item::with(branding))
|
||||
.add_item(flex::Item::with(menu)),
|
||||
));
|
||||
InRegion::Named("pagetop").add(AnyComponent::with(
|
||||
Block::new()
|
||||
.with_style(StyleBase::Info)
|
||||
.add_component(Paragraph::fluent(L10n::t(
|
||||
"under_construction",
|
||||
&LOCALES_WEBSITE,
|
||||
))),
|
||||
));
|
||||
InRegion::Named("footer").add(AnyComponent::with(PoweredBy::new()));
|
||||
*/
|
||||
InRegion::Named("header").add(AnyComponent::with(
|
||||
flex::Container::new()
|
||||
.with_direction(flex::Direction::Row(BreakPoint::None))
|
||||
.with_justify(flex::Justify::SpaceBetween)
|
||||
.with_align(flex::Align::End)
|
||||
.add_item(flex::Item::with(branding))
|
||||
.add_item(flex::Item::with(menu)),
|
||||
));
|
||||
InRegion::Named("pagetop").add(AnyComponent::with(
|
||||
Block::new()
|
||||
.with_style(StyleBase::Info)
|
||||
.add_component(Paragraph::fluent(L10n::t(
|
||||
"under_construction",
|
||||
&LOCALES_WEBSITE,
|
||||
))),
|
||||
));
|
||||
InRegion::Named("footer").add(AnyComponent::with(PoweredBy::new()));
|
||||
*/
|
||||
}
|
||||
|
||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
||||
|
|
@ -128,8 +107,8 @@ impl PackageTrait for PageTopWebSite {
|
|||
|
||||
async fn doc_latest(path: service::web::Path<String>) -> service::HttpResponse {
|
||||
match path.into_inner().as_str() {
|
||||
"es" => Redirect::see_other("/doc/v0.0/es/index.html"),
|
||||
_ => Redirect::see_other("/doc/v0.0/en/index.html"),
|
||||
"en" => Redirect::see_other("/doc/v0.0/en/index.html"),
|
||||
_ => Redirect::see_other("/doc/v0.0/es/index.html"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue