Modifica el renderizado de contenedores internos

This commit is contained in:
Manuel Cillero 2022-03-31 00:50:53 +02:00
parent 363cec7a75
commit 48fa9e9db9
3 changed files with 20 additions and 28 deletions

View file

@ -39,34 +39,34 @@ impl PageComponent for Container {
ContainerType::Header => html! {
header id=[self.id()] class=[self.classes("header")] {
div class="container" {
(self.render_components(assets))
(self.components().render(assets))
}
}
},
ContainerType::Footer => html! {
footer id=[self.id()] class=[self.classes("footer")] {
div class="container" {
(self.render_components(assets))
(self.components().render(assets))
}
}
},
ContainerType::Main => html! {
main id=[self.id()] class=[self.classes("main")] {
div class="container" {
(self.render_components(assets))
(self.components().render(assets))
}
}
},
ContainerType::Section => html! {
section id=[self.id()] class=[self.classes("section")] {
div class="container" {
(self.render_components(assets))
(self.components().render(assets))
}
}
},
_ => html! {
div id=[self.id()] class=[self.classes("container")] {
(self.render_components(assets))
(self.components().render(assets))
}
}
}
@ -142,6 +142,10 @@ impl Container {
&self.container
}
pub fn components(&self) -> &PageContainer {
&self.components
}
pub fn id(&self) -> &Option<String> {
self.id.option()
}
@ -153,12 +157,6 @@ impl Container {
pub fn template(&self) -> &str {
self.template.as_str()
}
// Container EXTRAS.
pub fn render_components(&self, assets: &mut PageAssets) -> Markup {
html! { (self.components.render(assets)) }
}
}
fn always() -> bool {

View file

@ -51,9 +51,7 @@ impl PageComponent for Form {
method=[method]
accept-charset=[self.charset()]
{
div {
(self.render_elements(assets))
}
div { (self.elements().render(assets)) }
}
}
}
@ -127,6 +125,10 @@ impl Form {
&self.method
}
pub fn elements(&self) -> &PageContainer {
&self.elements
}
pub fn id(&self) -> &Option<String> {
self.id.option()
}
@ -138,12 +140,6 @@ impl Form {
pub fn template(&self) -> &str {
self.template.as_str()
}
// Form EXTRAS.
pub fn render_elements(&self, assets: &mut PageAssets) -> Markup {
html! { (self.elements.render(assets)) }
}
}
fn always() -> bool {

View file

@ -58,7 +58,7 @@ impl PageComponent for MenuItem {
li class="submenu" {
a href="#" { (label) }
ul {
(menu.render_items(assets))
(menu.items().render(assets))
}
}
},
@ -198,7 +198,7 @@ impl PageComponent for Menu {
let id = assets.serial_id(self.name(), self.id());
html! {
ul id=(id) class=[self.classes("sm sm-clean")] {
(self.render_items(assets))
(self.items().render(assets))
}
script type="text/javascript" defer {
"jQuery(function(){jQuery('#" (id) "').smartmenus({"
@ -251,6 +251,10 @@ impl Menu {
// Menu GETTERS.
pub fn items(&self) -> &PageContainer {
&self.items
}
pub fn id(&self) -> &Option<String> {
self.id.option()
}
@ -262,12 +266,6 @@ impl Menu {
pub fn template(&self) -> &str {
self.template.as_str()
}
// Menu EXTRAS.
pub fn render_items(&self, assets: &mut PageAssets) -> Markup {
html! { (self.items.render(assets)) }
}
}
fn always() -> bool {