🚧 [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"
|
name = "PageTop"
|
||||||
description = "An opinionated web framework to build modular Server-Side Rendering web solutions."
|
description = "An opinionated web framework to build modular Server-Side Rendering web solutions."
|
||||||
theme = "Bootsier"
|
theme = "Bootsier"
|
||||||
|
language = "es"
|
||||||
|
|
||||||
[bootsier]
|
[bootsier]
|
||||||
max_width = "1520px"
|
max_width = "1520px"
|
||||||
|
|
|
||||||
|
|
@ -27,20 +27,20 @@ impl PackageTrait for PageTopWebSite {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn init(&self) {
|
fn init(&self) {
|
||||||
let nav = Navbar::new().with_nav(TypedOp::Add(Typed::with(
|
let nav = Navbar::with_nav(
|
||||||
navbar::Nav::new()
|
navbar::Nav::new()
|
||||||
.with_item(navbar::Item::link(
|
.with_item(navbar::Item::link(
|
||||||
L10n::t("menu_home", &LOCALES_WEBSITE),
|
L10n::t("menu_home", &LOCALES_WEBSITE),
|
||||||
|cx| match cx.langid().language.as_str() {
|
|cx| match cx.langid().language.as_str() {
|
||||||
"es" => "/es",
|
"en" => "/en",
|
||||||
_ => "/",
|
_ => "/",
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
.with_item(navbar::Item::link(
|
.with_item(navbar::Item::link(
|
||||||
L10n::t("menu_documentation", &LOCALES_WEBSITE),
|
L10n::t("menu_documentation", &LOCALES_WEBSITE),
|
||||||
|cx| match cx.langid().language.as_str() {
|
|cx| match cx.langid().language.as_str() {
|
||||||
"es" => "/doc/latest/es",
|
"en" => "/doc/latest/en",
|
||||||
_ => "/doc/latest/en",
|
_ => "/doc/latest/es",
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
.with_item(navbar::Item::link_blank(
|
.with_item(navbar::Item::link_blank(
|
||||||
|
|
@ -50,74 +50,53 @@ impl PackageTrait for PageTopWebSite {
|
||||||
.with_item(navbar::Item::link_blank(
|
.with_item(navbar::Item::link_blank(
|
||||||
L10n::t("menu_code", &LOCALES_WEBSITE),
|
L10n::t("menu_code", &LOCALES_WEBSITE),
|
||||||
|_| "https://github.com/manuelcillero/pagetop",
|
|_| "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));
|
InRegion::Content.add(Child::with(nav));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
let branding = Branding::new()
|
let branding = Branding::new()
|
||||||
.with_logo(Some(Image::pagetop()))
|
.with_logo(Some(Image::pagetop()))
|
||||||
.with_slogan(L10n::t("app_slogan", &LOCALES_WEBSITE))
|
.with_slogan(L10n::t("app_slogan", &LOCALES_WEBSITE))
|
||||||
.with_frontpage(|cx| match cx.langid().language.as_str() {
|
.with_frontpage(|cx| match cx.langid().language.as_str() {
|
||||||
"es" => "/es",
|
"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;});
|
|
||||||
"###
|
|
||||||
}
|
|
||||||
})));
|
|
||||||
|
|
||||||
InRegion::Named("header").add(AnyComponent::with(
|
InRegion::Named("header").add(AnyComponent::with(
|
||||||
flex::Container::new()
|
flex::Container::new()
|
||||||
.with_direction(flex::Direction::Row(BreakPoint::None))
|
.with_direction(flex::Direction::Row(BreakPoint::None))
|
||||||
.with_justify(flex::Justify::SpaceBetween)
|
.with_justify(flex::Justify::SpaceBetween)
|
||||||
.with_align(flex::Align::End)
|
.with_align(flex::Align::End)
|
||||||
.add_item(flex::Item::with(branding))
|
.add_item(flex::Item::with(branding))
|
||||||
.add_item(flex::Item::with(menu)),
|
.add_item(flex::Item::with(menu)),
|
||||||
));
|
));
|
||||||
InRegion::Named("pagetop").add(AnyComponent::with(
|
InRegion::Named("pagetop").add(AnyComponent::with(
|
||||||
Block::new()
|
Block::new()
|
||||||
.with_style(StyleBase::Info)
|
.with_style(StyleBase::Info)
|
||||||
.add_component(Paragraph::fluent(L10n::t(
|
.add_component(Paragraph::fluent(L10n::t(
|
||||||
"under_construction",
|
"under_construction",
|
||||||
&LOCALES_WEBSITE,
|
&LOCALES_WEBSITE,
|
||||||
))),
|
))),
|
||||||
));
|
));
|
||||||
InRegion::Named("footer").add(AnyComponent::with(PoweredBy::new()));
|
InRegion::Named("footer").add(AnyComponent::with(PoweredBy::new()));
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
|
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 {
|
async fn doc_latest(path: service::web::Path<String>) -> service::HttpResponse {
|
||||||
match path.into_inner().as_str() {
|
match path.into_inner().as_str() {
|
||||||
"es" => Redirect::see_other("/doc/v0.0/es/index.html"),
|
"en" => Redirect::see_other("/doc/v0.0/en/index.html"),
|
||||||
_ => 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