use crate::prelude::*;
pub struct Welcome;
impl Extension for Welcome {
fn name(&self) -> L10n {
L10n::l("welcome_extension_name")
}
fn description(&self) -> L10n {
L10n::l("welcome_extension_description")
}
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
scfg.route("/", service::web::get().to(home));
}
}
async fn home(request: HttpRequest) -> ResultPage<Markup, ErrorPage> {
let app = &global::SETTINGS.app.name;
Page::new(request)
.with_title(L10n::l("welcome_title"))
.with_child(
Intro::new()
.with_child(
Block::new()
.with_title(L10n::l("welcome_status_title"))
.with_child(Html::with(move |cx| {
html! {
p class="intro-text-lead" {
(L10n::l("welcome_status_1").using(cx))
}
p class="intro-text-lead" {
(L10n::l("welcome_status_2").using(cx))
}
}
})),
)
.with_child(
Block::new()
.with_title(L10n::l("welcome_support_title"))
.with_child(Html::with(move |cx| {
html! {
p class="intro-text-lead" {
(L10n::l("welcome_support_1").using(cx))
}
p class="intro-text-lead" {
(L10n::l("welcome_support_2").with_arg("app", app).using(cx))
}
}
})),
),
)
.render()
}