✨ Add with_component() to region "content" in Page
This commit is contained in:
parent
9be23d3cd8
commit
e011cf7f62
8 changed files with 19 additions and 14 deletions
|
|
@ -15,7 +15,7 @@ async fn hello_name(
|
||||||
) -> ResultPage<Markup, ErrorPage> {
|
) -> ResultPage<Markup, ErrorPage> {
|
||||||
let name = path.into_inner();
|
let name = path.into_inner();
|
||||||
Page::new(request)
|
Page::new(request)
|
||||||
.with_component_in("content", Html::with(html! { h1 { "Hello " (name) "!" } }))
|
.with_component(Html::with(html! { h1 { "Hello " (name) "!" } }))
|
||||||
.render()
|
.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ impl PackageTrait for HelloWorld {
|
||||||
|
|
||||||
async fn hello_world(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
async fn hello_world(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
||||||
Page::new(request)
|
Page::new(request)
|
||||||
.with_component_in("content", Html::with(html! { h1 { "Hello World!" } }))
|
.with_component(Html::with(html! { h1 { "Hello World!" } }))
|
||||||
.render()
|
.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,7 @@ pub async fn summary(request: service::HttpRequest) -> ResultPage<Markup, ErrorP
|
||||||
//.with_context(ContextOp::Theme("Bootsier"))
|
//.with_context(ContextOp::Theme("Bootsier"))
|
||||||
.with_title(L10n::n("Admin"))
|
.with_title(L10n::n("Admin"))
|
||||||
.with_component_in("top-menu", side_menu)
|
.with_component_in("top-menu", side_menu)
|
||||||
.with_component_in(
|
.with_component(
|
||||||
"content",
|
|
||||||
flex::Container::new()
|
flex::Container::new()
|
||||||
.add_item(flex::Item::new().add_component(Html::with(html! {
|
.add_item(flex::Item::new().add_component(Html::with(html! {
|
||||||
p { "Columna 1"}
|
p { "Columna 1"}
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,7 @@ impl PackageTrait for User {
|
||||||
async fn login(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
async fn login(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
||||||
Page::new(request)
|
Page::new(request)
|
||||||
.with_title(L10n::n("Identificación del usuario"))
|
.with_title(L10n::n("Identificación del usuario"))
|
||||||
.with_component_in(
|
.with_component(
|
||||||
"content",
|
|
||||||
Wrapper::new()
|
Wrapper::new()
|
||||||
.with_id("welcome")
|
.with_id("welcome")
|
||||||
.add_component(form_login()),
|
.add_component(form_login()),
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,11 @@ async fn demo(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
||||||
"/base/css/welcome.css",
|
"/base/css/welcome.css",
|
||||||
)))
|
)))
|
||||||
.with_body_id("welcome")
|
.with_body_id("welcome")
|
||||||
.with_component_in("content", hello_world())
|
.with_component(hello_world())
|
||||||
.with_component_in("content", welcome())
|
.with_component(welcome())
|
||||||
.with_component_in("content", about_pagetop())
|
.with_component(about_pagetop())
|
||||||
.with_component_in("content", promo_pagetop())
|
.with_component(promo_pagetop())
|
||||||
.with_component_in("content", reporting_issues())
|
.with_component(reporting_issues())
|
||||||
.render()
|
.render()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
//!
|
//!
|
||||||
//! async fn hello_world(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
//! async fn hello_world(request: service::HttpRequest) -> ResultPage<Markup, ErrorPage> {
|
||||||
//! Page::new(request)
|
//! Page::new(request)
|
||||||
//! .with_component_in("content", Html::with(html! { h1 { "Hello World!" } }))
|
//! .with_component(Html::with(html! { h1 { "Hello World!" } }))
|
||||||
//! .render()
|
//! .render()
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,13 @@ impl Page {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[fn_with]
|
||||||
|
pub fn alter_component(&mut self, component: impl ComponentTrait) -> &mut Self {
|
||||||
|
self.regions
|
||||||
|
.add_component_in("content", ArcAnyComponent::new(component));
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
#[fn_with]
|
#[fn_with]
|
||||||
pub fn alter_component_in(
|
pub fn alter_component_in(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ impl fmt::Display for ErrorPage {
|
||||||
let error_page = Page::new(request.clone());
|
let error_page = Page::new(request.clone());
|
||||||
if let Ok(page) = error_page
|
if let Ok(page) = error_page
|
||||||
.with_title(L10n::n("Error FORBIDDEN"))
|
.with_title(L10n::n("Error FORBIDDEN"))
|
||||||
.with_component_in("content", Error403)
|
.with_component(Error403)
|
||||||
.with_template("error")
|
.with_template("error")
|
||||||
.render()
|
.render()
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +45,7 @@ impl fmt::Display for ErrorPage {
|
||||||
let error_page = Page::new(request.clone());
|
let error_page = Page::new(request.clone());
|
||||||
if let Ok(page) = error_page
|
if let Ok(page) = error_page
|
||||||
.with_title(L10n::n("Error RESOURCE NOT FOUND"))
|
.with_title(L10n::n("Error RESOURCE NOT FOUND"))
|
||||||
.with_component_in("content", Error404)
|
.with_component(Error404)
|
||||||
.with_template("error")
|
.with_template("error")
|
||||||
.render()
|
.render()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue