Actualiza nomenclatura de tipos
This commit is contained in:
parent
72f5144b75
commit
96cbbb0c3c
24 changed files with 73 additions and 73 deletions
|
|
@ -55,7 +55,7 @@ impl ComponentTrait for Anchor {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
let target = match &self.target() {
|
||||
AnchorTarget::Blank => Some("_blank"),
|
||||
AnchorTarget::Context(name) => Some(name.as_str()),
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ pub const BLOCK_COMPONENT: &str = "pagetop::component::block";
|
|||
pub struct Block {
|
||||
renderable: fn() -> bool,
|
||||
weight : isize,
|
||||
components: ComponentsHolder,
|
||||
components: ComponentsBundle,
|
||||
title : OptAttr,
|
||||
id : OptIden,
|
||||
classes : Classes,
|
||||
|
|
@ -17,7 +17,7 @@ impl ComponentTrait for Block {
|
|||
Block {
|
||||
renderable: render_always,
|
||||
weight : 0,
|
||||
components: ComponentsHolder::new(),
|
||||
components: ComponentsBundle::new(),
|
||||
title : OptAttr::new(),
|
||||
id : OptIden::new(),
|
||||
classes : Classes::new_with_default("block"),
|
||||
|
|
@ -37,7 +37,7 @@ impl ComponentTrait for Block {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
let id = context.required_id::<Block>(self.id());
|
||||
html! {
|
||||
div id=(id) class=[self.classes()] {
|
||||
|
|
@ -70,7 +70,7 @@ impl Block {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn components(&self) -> &ComponentsHolder {
|
||||
pub fn components(&self) -> &ComponentsBundle {
|
||||
&self.components
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl ComponentTrait for Chunck {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
html! { (*self.html()) }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pub enum ContainerType { Header, Footer, Main, Section, Wrapper }
|
|||
pub struct Container {
|
||||
renderable : fn() -> bool,
|
||||
weight : isize,
|
||||
components : ComponentsHolder,
|
||||
components : ComponentsBundle,
|
||||
container : ContainerType,
|
||||
id : OptIden,
|
||||
classes : Classes,
|
||||
|
|
@ -20,7 +20,7 @@ impl ComponentTrait for Container {
|
|||
Container {
|
||||
renderable : render_always,
|
||||
weight : 0,
|
||||
components : ComponentsHolder::new(),
|
||||
components : ComponentsBundle::new(),
|
||||
container : ContainerType::Wrapper,
|
||||
id : OptIden::new(),
|
||||
classes : Classes::new_with_default("container"),
|
||||
|
|
@ -41,7 +41,7 @@ impl ComponentTrait for Container {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
match self.container_type() {
|
||||
ContainerType::Header => html! {
|
||||
header id=[self.id()] class=[self.classes()] {
|
||||
|
|
@ -120,7 +120,7 @@ impl Container {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn components(&self) -> &ComponentsHolder {
|
||||
pub fn components(&self) -> &ComponentsBundle {
|
||||
&self.components
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ impl ComponentTrait for Button {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
let button_type = match self.button_type() {
|
||||
ButtonType::Button => "button",
|
||||
ButtonType::Reset => "reset",
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ impl ComponentTrait for Date {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
let id = match self.name() {
|
||||
Some(name) => Some(concat_string!("edit-", name)),
|
||||
None => None,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ pub enum FormMethod {Get, Post}
|
|||
pub struct Form {
|
||||
renderable: fn() -> bool,
|
||||
weight : isize,
|
||||
elements : ComponentsHolder,
|
||||
elements : ComponentsBundle,
|
||||
action : OptAttr,
|
||||
charset : OptAttr,
|
||||
method : FormMethod,
|
||||
|
|
@ -21,7 +21,7 @@ impl ComponentTrait for Form {
|
|||
Form {
|
||||
renderable: render_always,
|
||||
weight : 0,
|
||||
elements : ComponentsHolder::new(),
|
||||
elements : ComponentsBundle::new(),
|
||||
action : OptAttr::new(),
|
||||
charset : OptAttr::new_with_value("UTF-8"),
|
||||
method : FormMethod::Post,
|
||||
|
|
@ -43,7 +43,7 @@ impl ComponentTrait for Form {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
let method = match self.method() {
|
||||
FormMethod::Get => None,
|
||||
FormMethod::Post => Some("post".to_owned())
|
||||
|
|
@ -79,7 +79,7 @@ impl Form {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn elements(&self) -> &ComponentsHolder {
|
||||
pub fn elements(&self) -> &ComponentsBundle {
|
||||
&self.elements
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl ComponentTrait for Hidden {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
let id = match self.name() {
|
||||
Some(name) => Some(concat_string!("value-", name)),
|
||||
_ => None
|
||||
|
|
|
|||
|
|
@ -62,14 +62,14 @@ impl ComponentTrait for Input {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn before_render(&mut self, _: &mut Context) {
|
||||
fn before_render(&mut self, _: &mut InContext) {
|
||||
if let Some(name) = self.name() {
|
||||
let class = concat_string!("form-item-", name);
|
||||
self.alter_classes(class.as_str(), ClassesOp::AddFirst);
|
||||
}
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
let type_input = match self.input_type() {
|
||||
InputType::Email => "email",
|
||||
InputType::Password => "password",
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ pub const COLUMN_COMPONENT: &str = "pagetop::component::grid::column";
|
|||
pub struct Column {
|
||||
renderable: fn() -> bool,
|
||||
weight : isize,
|
||||
components: ComponentsHolder,
|
||||
components: ComponentsBundle,
|
||||
id : OptIden,
|
||||
classes : Classes,
|
||||
template : String,
|
||||
|
|
@ -16,7 +16,7 @@ impl ComponentTrait for Column {
|
|||
Column {
|
||||
renderable: render_always,
|
||||
weight : 0,
|
||||
components: ComponentsHolder::new(),
|
||||
components: ComponentsBundle::new(),
|
||||
id : OptIden::new(),
|
||||
classes : Classes::new_with_default("col"),
|
||||
template : "default".to_owned(),
|
||||
|
|
@ -35,7 +35,7 @@ impl ComponentTrait for Column {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
html! {
|
||||
div id=[self.id()] class=[self.classes()] {
|
||||
(self.components().render(context))
|
||||
|
|
@ -61,7 +61,7 @@ impl Column {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn components(&self) -> &ComponentsHolder {
|
||||
pub fn components(&self) -> &ComponentsBundle {
|
||||
&self.components
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ pub const ROW_COMPONENT: &str = "pagetop::component::grid::row";
|
|||
pub struct Row {
|
||||
renderable: fn() -> bool,
|
||||
weight : isize,
|
||||
columns : ComponentsHolder,
|
||||
columns : ComponentsBundle,
|
||||
id : OptIden,
|
||||
classes : Classes,
|
||||
template : String,
|
||||
|
|
@ -16,7 +16,7 @@ impl ComponentTrait for Row {
|
|||
Row {
|
||||
renderable: render_always,
|
||||
weight : 0,
|
||||
columns : ComponentsHolder::new(),
|
||||
columns : ComponentsBundle::new(),
|
||||
id : OptIden::new(),
|
||||
classes : Classes::new_with_default("row"),
|
||||
template : "default".to_owned(),
|
||||
|
|
@ -35,7 +35,7 @@ impl ComponentTrait for Row {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
html! {
|
||||
div id=[self.id()] class=[self.classes()] {
|
||||
(self.columns().render(context))
|
||||
|
|
@ -61,7 +61,7 @@ impl Row {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn columns(&self) -> &ComponentsHolder {
|
||||
pub fn columns(&self) -> &ComponentsBundle {
|
||||
&self.columns
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ impl ComponentTrait for Heading {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
html! { @match &self.heading() {
|
||||
HeadingType::H1 => h1 id=[self.id()] class=[self.classes()] { (*self.html()) },
|
||||
HeadingType::H2 => h2 id=[self.id()] class=[self.classes()] { (*self.html()) },
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ impl ComponentTrait for Image {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
html! {
|
||||
img
|
||||
src=[self.source()]
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ impl ComponentTrait for MenuItem {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
match self.item_type() {
|
||||
MenuItemType::Label(label) => html! {
|
||||
li class="label" { a href="#" { (label) } }
|
||||
|
|
@ -176,7 +176,7 @@ impl MenuItem {
|
|||
pub struct Menu {
|
||||
renderable: fn() -> bool,
|
||||
weight : isize,
|
||||
items : ComponentsHolder,
|
||||
items : ComponentsBundle,
|
||||
id : OptIden,
|
||||
classes : Classes,
|
||||
template : String,
|
||||
|
|
@ -187,7 +187,7 @@ impl ComponentTrait for Menu {
|
|||
Menu {
|
||||
renderable: render_always,
|
||||
weight : 0,
|
||||
items : ComponentsHolder::new(),
|
||||
items : ComponentsBundle::new(),
|
||||
id : OptIden::new(),
|
||||
classes : Classes::new_with_default("sm sm-clean"),
|
||||
template : "default".to_owned(),
|
||||
|
|
@ -206,7 +206,7 @@ impl ComponentTrait for Menu {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
context
|
||||
.add_stylesheet(StyleSheet::source(
|
||||
"/theme/menu/css/menu.css?ver=1.1.1"
|
||||
|
|
@ -251,7 +251,7 @@ impl Menu {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn items(&self) -> &ComponentsHolder {
|
||||
pub fn items(&self) -> &ComponentsBundle {
|
||||
&self.items
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ impl ComponentTrait for Paragraph {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut Context) -> Markup {
|
||||
fn default_render(&self, _: &mut InContext) -> Markup {
|
||||
html! {
|
||||
p id=[self.id()] class=[self.classes()] { (*self.html()) }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ impl ThemeTrait for Bulmix {
|
|||
fn before_render_component(
|
||||
&self,
|
||||
component: &mut dyn ComponentTrait,
|
||||
_context: &mut Context
|
||||
_context: &mut InContext
|
||||
) {
|
||||
match component.handler() {
|
||||
HEADING_COMPONENT => {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ pub use hook::{
|
|||
};
|
||||
|
||||
mod context;
|
||||
pub use context::InContext;
|
||||
pub use context::{
|
||||
Context,
|
||||
Favicon,
|
||||
JavaScript, JSMode,
|
||||
StyleSheet,
|
||||
|
|
@ -21,8 +21,8 @@ pub use definition::{
|
|||
};
|
||||
use definition::render_component;
|
||||
|
||||
mod holder;
|
||||
pub use holder::ComponentsHolder;
|
||||
mod bundle;
|
||||
pub use bundle::ComponentsBundle;
|
||||
|
||||
mod all;
|
||||
pub use all::add_component_to;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use crate::Lazy;
|
||||
use super::{ComponentsHolder, ComponentTrait};
|
||||
use super::{ComponentsBundle, ComponentTrait};
|
||||
|
||||
use std::sync::RwLock;
|
||||
use std::collections::HashMap;
|
||||
|
||||
static COMPONENTS: Lazy<RwLock<HashMap<&str, ComponentsHolder>>> = Lazy::new(|| {
|
||||
static COMPONENTS: Lazy<RwLock<HashMap<&str, ComponentsBundle>>> = Lazy::new(|| {
|
||||
RwLock::new(HashMap::new())
|
||||
});
|
||||
|
||||
|
|
@ -13,10 +13,10 @@ pub fn add_component_to(region: &'static str, component: impl ComponentTrait) {
|
|||
if let Some(regions) = hmap.get_mut(region) {
|
||||
regions.add(component);
|
||||
} else {
|
||||
hmap.insert(region, ComponentsHolder::new_with(component));
|
||||
hmap.insert(region, ComponentsBundle::new_with(component));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn common_components() -> HashMap<&'static str, ComponentsHolder> {
|
||||
pub fn common_components() -> HashMap<&'static str, ComponentsBundle> {
|
||||
COMPONENTS.read().unwrap().clone()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
use crate::html::{Markup, html};
|
||||
use super::{Context, ComponentTrait};
|
||||
use super::{InContext, ComponentTrait};
|
||||
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ComponentsHolder(Vec<Arc<RwLock<dyn ComponentTrait>>>);
|
||||
pub struct ComponentsBundle(Vec<Arc<RwLock<dyn ComponentTrait>>>);
|
||||
|
||||
impl ComponentsHolder {
|
||||
impl ComponentsBundle {
|
||||
pub fn new() -> Self {
|
||||
ComponentsHolder(Vec::new())
|
||||
ComponentsBundle(Vec::new())
|
||||
}
|
||||
|
||||
pub fn new_with(component: impl ComponentTrait) -> Self {
|
||||
let mut container = ComponentsHolder::new();
|
||||
let mut container = ComponentsBundle::new();
|
||||
container.add(component);
|
||||
container
|
||||
}
|
||||
|
|
@ -21,7 +21,7 @@ impl ComponentsHolder {
|
|||
self.0.push(Arc::new(RwLock::new(component)));
|
||||
}
|
||||
|
||||
pub fn render(&self, context: &mut Context) -> Markup {
|
||||
pub fn render(&self, context: &mut InContext) -> Markup {
|
||||
let mut components = self.0.clone();
|
||||
components.sort_by_key(|c| c.read().unwrap().weight());
|
||||
html! {
|
||||
|
|
@ -19,7 +19,7 @@ static DEFAULT_THEME: Lazy<&dyn ThemeTrait> = Lazy::new(|| {
|
|||
}
|
||||
});
|
||||
|
||||
pub struct Context {
|
||||
pub struct InContext {
|
||||
theme : &'static dyn ThemeTrait,
|
||||
favicon : Option<Favicon>,
|
||||
metadata : Vec<(String, String)>,
|
||||
|
|
@ -29,9 +29,9 @@ pub struct Context {
|
|||
id_counter : usize,
|
||||
}
|
||||
|
||||
impl Context {
|
||||
impl InContext {
|
||||
pub fn new() -> Self {
|
||||
Context {
|
||||
InContext {
|
||||
theme : *DEFAULT_THEME,
|
||||
favicon : None,
|
||||
metadata : Vec::new(),
|
||||
|
|
@ -93,20 +93,20 @@ impl Context {
|
|||
self
|
||||
}
|
||||
|
||||
/// Context GETTERS.
|
||||
/// InContext GETTERS.
|
||||
|
||||
pub(crate) fn theme(&mut self) -> &'static dyn ThemeTrait {
|
||||
self.theme
|
||||
}
|
||||
|
||||
/// Context RENDER.
|
||||
/// InContext RENDER.
|
||||
|
||||
pub fn render(&mut self) -> Markup {
|
||||
let ordered_css = &mut self.stylesheets;
|
||||
ordered_css.sort_by_key(|o| o.weight);
|
||||
ordered_css.sort_by_key(|css| css.weight);
|
||||
|
||||
let ordered_js = &mut self.javascripts;
|
||||
ordered_js.sort_by_key(|o| o.weight);
|
||||
ordered_js.sort_by_key(|js| js.weight);
|
||||
|
||||
html! {
|
||||
@match &self.favicon {
|
||||
|
|
@ -125,7 +125,7 @@ impl Context {
|
|||
}
|
||||
}
|
||||
|
||||
// Context EXTRAS.
|
||||
// InContext EXTRAS.
|
||||
|
||||
pub fn required_id<T>(&mut self, id: &Option<String>) -> String {
|
||||
match id {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use crate::util;
|
||||
use crate::html::{Markup, html};
|
||||
use crate::core::hook::{hook_ref, run_hooks};
|
||||
use super::{BEFORE_RENDER_COMPONENT_HOOK, BeforeRenderComponentHook, Context};
|
||||
use super::{BEFORE_RENDER_COMPONENT_HOOK, BeforeRenderComponentHook, InContext};
|
||||
|
||||
pub use std::any::Any as AnyComponent;
|
||||
|
||||
|
|
@ -27,11 +27,11 @@ pub trait ComponentTrait: AnyComponent + Send + Sync {
|
|||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn before_render(&mut self, context: &mut Context) {
|
||||
fn before_render(&mut self, context: &mut InContext) {
|
||||
}
|
||||
|
||||
#[allow(unused_variables)]
|
||||
fn default_render(&self, context: &mut Context) -> Markup {
|
||||
fn default_render(&self, context: &mut InContext) -> Markup {
|
||||
html! {}
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ pub fn component_mut<C: 'static>(component: &mut dyn ComponentTrait) -> &mut C {
|
|||
component.as_mut_any().downcast_mut::<C>().unwrap()
|
||||
}
|
||||
|
||||
pub fn render_component(component: &mut dyn ComponentTrait, context: &mut Context) -> Markup {
|
||||
pub fn render_component(component: &mut dyn ComponentTrait, context: &mut InContext) -> Markup {
|
||||
// Acciones del componente antes de renderizar.
|
||||
component.before_render(context);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
use crate::core::hook::{HookTrait, AnyHook};
|
||||
use super::{ComponentTrait, Context};
|
||||
use super::{ComponentTrait, InContext};
|
||||
|
||||
pub const BEFORE_RENDER_COMPONENT_HOOK: &str = "pagetop::hook::before_render_component";
|
||||
|
||||
pub struct BeforeRenderComponentHook {
|
||||
hook: Option<fn(&mut dyn ComponentTrait, &mut Context)>,
|
||||
hook: Option<fn(&mut dyn ComponentTrait, &mut InContext)>,
|
||||
weight: isize,
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ impl HookTrait for BeforeRenderComponentHook {
|
|||
}
|
||||
|
||||
impl BeforeRenderComponentHook {
|
||||
pub fn with_hook(mut self, hook: fn(&mut dyn ComponentTrait, &mut Context)) -> Self {
|
||||
pub fn with_hook(mut self, hook: fn(&mut dyn ComponentTrait, &mut InContext)) -> Self {
|
||||
self.hook = Some(hook);
|
||||
self
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ impl BeforeRenderComponentHook {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn run(&self, component: &mut dyn ComponentTrait, context: &mut Context) {
|
||||
pub fn run(&self, component: &mut dyn ComponentTrait, context: &mut InContext) {
|
||||
if let Some(hook) = self.hook {
|
||||
hook(component, context)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use crate::{concat_string, util};
|
|||
use crate::config::SETTINGS;
|
||||
use crate::html::{Markup, html};
|
||||
use crate::core::app;
|
||||
use crate::core::component::{ComponentTrait, Context, Favicon};
|
||||
use crate::core::component::{ComponentTrait, Favicon, InContext};
|
||||
use crate::response::page::Page;
|
||||
use crate::base::component::Chunck;
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
|
|||
fn before_render_component(
|
||||
&self,
|
||||
component: &mut dyn ComponentTrait,
|
||||
context: &mut Context
|
||||
context: &mut InContext
|
||||
) {
|
||||
/*
|
||||
Cómo usarlo:
|
||||
|
|
@ -105,7 +105,7 @@ pub trait ThemeTrait: BaseTheme + Send + Sync {
|
|||
fn render_component(
|
||||
&self,
|
||||
component: &dyn ComponentTrait,
|
||||
context: &mut Context
|
||||
context: &mut InContext
|
||||
) -> Option<Markup> {
|
||||
None
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ pub struct Page<'a> {
|
|||
direction : OptAttr,
|
||||
title : OptAttr,
|
||||
description : OptAttr,
|
||||
context : Context,
|
||||
regions : HashMap<&'a str, ComponentsHolder>,
|
||||
context : InContext,
|
||||
regions : HashMap<&'a str, ComponentsBundle>,
|
||||
body_classes: Classes,
|
||||
template : String,
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ impl<'a> Page<'a> {
|
|||
},
|
||||
title : OptAttr::new(),
|
||||
description : OptAttr::new(),
|
||||
context : Context::new(),
|
||||
context : InContext::new(),
|
||||
regions : common_components(),
|
||||
body_classes: Classes::new_with_default("body"),
|
||||
template : "default".to_owned(),
|
||||
|
|
@ -103,7 +103,7 @@ impl<'a> Page<'a> {
|
|||
if let Some(regions) = self.regions.get_mut(region) {
|
||||
regions.add(component);
|
||||
} else {
|
||||
self.regions.insert(region, ComponentsHolder::new_with(component));
|
||||
self.regions.insert(region, ComponentsBundle::new_with(component));
|
||||
}
|
||||
self
|
||||
}
|
||||
|
|
@ -136,7 +136,7 @@ impl<'a> Page<'a> {
|
|||
self.description.option()
|
||||
}
|
||||
|
||||
pub fn context(&mut self) -> &mut Context {
|
||||
pub fn context(&mut self) -> &mut InContext {
|
||||
&mut self.context
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue