Actualiza el componente Chunck para llamarse Html

This commit is contained in:
Manuel Cillero 2022-07-23 08:08:25 +02:00
parent bd5ccdef8a
commit 280fa4cac1
5 changed files with 17 additions and 17 deletions

View file

@ -48,7 +48,7 @@ pub async fn summary() -> ResultPage<Markup, FatalError> {
"content", "content",
grid::Row::new() grid::Row::new()
.with_column(grid::Column::new().with_component(side_menu)) .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"} p { "Columna 2"}
}))), }))),
) )

View file

@ -3,8 +3,8 @@ pub use container::{Container, ContainerType, COMPONENT_CONTAINER};
pub mod grid; pub mod grid;
mod chunck; mod html;
pub use chunck::{Chunck, COMPONENT_CHUNCK}; pub use html::{Html, COMPONENT_HTML};
mod icon; mod icon;
pub use icon::{Icon, COMPONENT_ICON}; pub use icon::{Icon, COMPONENT_ICON};
mod heading; mod heading;

View file

@ -1,17 +1,17 @@
use crate::prelude::*; 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, weight : isize,
renderable: Renderable, renderable: Renderable,
html : Markup, html : Markup,
template : String, template : String,
} }
impl ComponentTrait for Chunck { impl ComponentTrait for Html {
fn new() -> Self { fn new() -> Self {
Chunck { Html {
weight : 0, weight : 0,
renderable: render_always, renderable: render_always,
html : html! {}, html : html! {},
@ -20,7 +20,7 @@ impl ComponentTrait for Chunck {
} }
fn handler(&self) -> &'static str { fn handler(&self) -> &'static str {
COMPONENT_CHUNCK COMPONENT_HTML
} }
fn weight(&self) -> isize { fn weight(&self) -> isize {
@ -44,12 +44,12 @@ impl ComponentTrait for Chunck {
} }
} }
impl Chunck { impl Html {
pub fn with(html: Markup) -> Self { 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 { pub fn with_weight(mut self, weight: isize) -> Self {
self.alter_weight(weight); self.alter_weight(weight);
@ -71,7 +71,7 @@ impl Chunck {
self self
} }
// Chunck ALTER. // Html ALTER.
pub fn alter_weight(&mut self, weight: isize) -> &mut Self { pub fn alter_weight(&mut self, weight: isize) -> &mut Self {
self.weight = weight; self.weight = weight;
@ -93,7 +93,7 @@ impl Chunck {
self self
} }
// Chunck GETTERS. // Html GETTERS.
pub fn html(&self) -> &Markup { pub fn html(&self) -> &Markup {
&self.html &self.html

View file

@ -37,7 +37,7 @@ impl ThemeTrait for Bootsier {
fn error_404_not_found(&self) -> Container { fn error_404_not_found(&self) -> Container {
Container::new() Container::new()
.with_component( .with_component(
Chunck::with(html! { Html::with(html! {
div class="jumbotron" { div class="jumbotron" {
div class="media" { div class="media" {
img img

View file

@ -1,5 +1,5 @@
use crate::app; use crate::app;
use crate::base::component::{Chunck, Container}; use crate::base::component::{Container, Html};
use crate::config::SETTINGS; use crate::config::SETTINGS;
use crate::core::component::{ComponentTrait, InContext, InContextOp}; use crate::core::component::{ComponentTrait, InContext, InContextOp};
use crate::html::{html, Favicon, Markup}; use crate::html::{html, Favicon, Markup};
@ -120,7 +120,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
fn error_404_not_found(&self) -> Container { fn error_404_not_found(&self) -> Container {
Container::new() Container::new()
.with_component( .with_component(
Chunck::with(html! { Html::with(html! {
div { div {
h1 { ("RESOURCE NOT FOUND") } h1 { ("RESOURCE NOT FOUND") }
} }
@ -131,7 +131,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
fn error_403_access_denied(&self) -> Container { fn error_403_access_denied(&self) -> Container {
Container::new() Container::new()
.with_component( .with_component(
Chunck::with(html! { Html::with(html! {
div { div {
h1 { ("FORBIDDEN ACCESS") } h1 { ("FORBIDDEN ACCESS") }
} }