From 280fa4cac1db9e5976d54568b362ea13fecf7f92 Mon Sep 17 00:00:00 2001 From: Manuel Cillero Date: Sat, 23 Jul 2022 08:08:25 +0200 Subject: [PATCH] Actualiza el componente Chunck para llamarse Html --- pagetop-admin/src/summary.rs | 2 +- pagetop/src/base/component.rs | 4 ++-- .../src/base/component/{chunck.rs => html.rs} | 20 +++++++++---------- pagetop/src/base/theme/bootsier.rs | 2 +- pagetop/src/core/theme/definition.rs | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) rename pagetop/src/base/component/{chunck.rs => html.rs} (87%) diff --git a/pagetop-admin/src/summary.rs b/pagetop-admin/src/summary.rs index 6f798252..c2f40b63 100644 --- a/pagetop-admin/src/summary.rs +++ b/pagetop-admin/src/summary.rs @@ -48,7 +48,7 @@ pub async fn summary() -> ResultPage { "content", grid::Row::new() .with_column(grid::Column::new().with_component(side_menu)) - .with_column(grid::Column::new().with_component(Chunck::with(html! { + .with_column(grid::Column::new().with_component(Html::with(html! { p { "Columna 2"} }))), ) diff --git a/pagetop/src/base/component.rs b/pagetop/src/base/component.rs index 4077888b..f01900e4 100644 --- a/pagetop/src/base/component.rs +++ b/pagetop/src/base/component.rs @@ -3,8 +3,8 @@ pub use container::{Container, ContainerType, COMPONENT_CONTAINER}; pub mod grid; -mod chunck; -pub use chunck::{Chunck, COMPONENT_CHUNCK}; +mod html; +pub use html::{Html, COMPONENT_HTML}; mod icon; pub use icon::{Icon, COMPONENT_ICON}; mod heading; diff --git a/pagetop/src/base/component/chunck.rs b/pagetop/src/base/component/html.rs similarity index 87% rename from pagetop/src/base/component/chunck.rs rename to pagetop/src/base/component/html.rs index 9622923a..438684a2 100644 --- a/pagetop/src/base/component/chunck.rs +++ b/pagetop/src/base/component/html.rs @@ -1,17 +1,17 @@ use crate::prelude::*; -pub const COMPONENT_CHUNCK: &str = "pagetop::component::chunck"; +pub const COMPONENT_HTML: &str = "pagetop::component::html"; -pub struct Chunck { +pub struct Html { weight : isize, renderable: Renderable, html : Markup, template : String, } -impl ComponentTrait for Chunck { +impl ComponentTrait for Html { fn new() -> Self { - Chunck { + Html { weight : 0, renderable: render_always, html : html! {}, @@ -20,7 +20,7 @@ impl ComponentTrait for Chunck { } fn handler(&self) -> &'static str { - COMPONENT_CHUNCK + COMPONENT_HTML } fn weight(&self) -> isize { @@ -44,12 +44,12 @@ impl ComponentTrait for Chunck { } } -impl Chunck { +impl Html { pub fn with(html: Markup) -> Self { - Chunck::new().with_html(html) + Html::new().with_html(html) } - // Chunck BUILDER. + // Html BUILDER. pub fn with_weight(mut self, weight: isize) -> Self { self.alter_weight(weight); @@ -71,7 +71,7 @@ impl Chunck { self } - // Chunck ALTER. + // Html ALTER. pub fn alter_weight(&mut self, weight: isize) -> &mut Self { self.weight = weight; @@ -93,7 +93,7 @@ impl Chunck { self } - // Chunck GETTERS. + // Html GETTERS. pub fn html(&self) -> &Markup { &self.html diff --git a/pagetop/src/base/theme/bootsier.rs b/pagetop/src/base/theme/bootsier.rs index 04f810f2..6dcf5fd0 100644 --- a/pagetop/src/base/theme/bootsier.rs +++ b/pagetop/src/base/theme/bootsier.rs @@ -37,7 +37,7 @@ impl ThemeTrait for Bootsier { fn error_404_not_found(&self) -> Container { Container::new() .with_component( - Chunck::with(html! { + Html::with(html! { div class="jumbotron" { div class="media" { img diff --git a/pagetop/src/core/theme/definition.rs b/pagetop/src/core/theme/definition.rs index 69c8a815..16cdef6c 100644 --- a/pagetop/src/core/theme/definition.rs +++ b/pagetop/src/core/theme/definition.rs @@ -1,5 +1,5 @@ use crate::app; -use crate::base::component::{Chunck, Container}; +use crate::base::component::{Container, Html}; use crate::config::SETTINGS; use crate::core::component::{ComponentTrait, InContext, InContextOp}; use crate::html::{html, Favicon, Markup}; @@ -120,7 +120,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync { fn error_404_not_found(&self) -> Container { Container::new() .with_component( - Chunck::with(html! { + Html::with(html! { div { h1 { ("RESOURCE NOT FOUND") } } @@ -131,7 +131,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync { fn error_403_access_denied(&self) -> Container { Container::new() .with_component( - Chunck::with(html! { + Html::with(html! { div { h1 { ("FORBIDDEN ACCESS") } }