👽️ Aplica cambios de API asociados a componentes
This commit is contained in:
parent
a39fee9297
commit
b5606f043a
16 changed files with 65 additions and 64 deletions
|
|
@ -134,18 +134,18 @@ impl ThemeTrait for Bootsier {
|
|||
div class="media-body" {
|
||||
h1 class="display-4" { ("RESOURCE NOT FOUND") }
|
||||
p class="lead" {
|
||||
(L10n::t("e404-description", &LOCALE_BOOTSIER).render(rcx))
|
||||
(L10n::t("e404-description", &LOCALE_BOOTSIER).prepare(rcx))
|
||||
}
|
||||
hr class="my-4";
|
||||
p {
|
||||
(L10n::t("e404-description", &LOCALE_BOOTSIER).render(rcx))
|
||||
(L10n::t("e404-description", &LOCALE_BOOTSIER).prepare(rcx))
|
||||
}
|
||||
a
|
||||
class="btn btn-primary btn-lg"
|
||||
href="/"
|
||||
role="button"
|
||||
{
|
||||
(L10n::t("back-homepage", &LOCALE_BOOTSIER).render(rcx))
|
||||
(L10n::t("back-homepage", &LOCALE_BOOTSIER).prepare(rcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ impl ThemeTrait for Bulmix {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn before_render_component(
|
||||
fn before_prepare_component(
|
||||
&self,
|
||||
component: &mut dyn ComponentTrait,
|
||||
_rcx: &mut RenderContext,
|
||||
|
|
|
|||
|
|
@ -44,29 +44,29 @@ impl ComponentTrait for MegaMenuItem {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
match self.item_type() {
|
||||
MegaMenuItemType::Void => html! {},
|
||||
|
||||
MegaMenuItemType::Label(label) => html! {
|
||||
li class="label" { a href="#" { (label.render(rcx)) } }
|
||||
li class="label" { a href="#" { (label.prepare(rcx)) } }
|
||||
},
|
||||
MegaMenuItemType::Link(label, path) => html! {
|
||||
li class="link" { a href=(path) { (label.render(rcx)) } }
|
||||
li class="link" { a href=(path) { (label.prepare(rcx)) } }
|
||||
},
|
||||
MegaMenuItemType::LinkBlank(label, path) => html! {
|
||||
li class="link_blank" {
|
||||
a href=(path) target="_blank" { (label.render(rcx)) }
|
||||
a href=(path) target="_blank" { (label.prepare(rcx)) }
|
||||
}
|
||||
},
|
||||
MegaMenuItemType::Html(content) => html! {
|
||||
li class="html" { (content.render(rcx)) }
|
||||
li class="html" { (content.prepare(rcx)) }
|
||||
},
|
||||
MegaMenuItemType::Submenu(label, menu) => html! {
|
||||
li class="submenu" {
|
||||
a href="#" { (label.render(rcx)) }
|
||||
a href="#" { (label.prepare(rcx)) }
|
||||
ul {
|
||||
(menu.items().render(rcx))
|
||||
(menu.items().prepare(rcx))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -153,7 +153,7 @@ impl MegaMenuItem {
|
|||
|
||||
use_handle!(COMPONENT_MEGAMENU);
|
||||
|
||||
action_before_render_component!(ACTION_BEFORE_RENDER_MENU for MegaMenu);
|
||||
action_before_prepare_component!(ACTION_BEFORE_PREPARE_MENU for MegaMenu);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
|
|
@ -187,11 +187,11 @@ impl ComponentTrait for MegaMenu {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn before_render(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_render_component(self, rcx);
|
||||
fn before_prepare(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_prepare_component(self, rcx);
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
rcx.alter(ContextOp::AddStyleSheet(
|
||||
StyleSheet::located("/megamenu/css/menu.css").with_version("1.1.1"),
|
||||
))
|
||||
|
|
@ -207,7 +207,7 @@ impl ComponentTrait for MegaMenu {
|
|||
|
||||
html! {
|
||||
ul id=(id) class=[self.classes().get()] {
|
||||
(self.items().render(rcx))
|
||||
(self.items().prepare(rcx))
|
||||
}
|
||||
script type="text/javascript" defer {
|
||||
"jQuery(function(){jQuery('#" (id) "').smartmenus({"
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ impl ComponentTrait for Anchor {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
let target = match &self.target() {
|
||||
AnchorTarget::Blank => Some("_blank"),
|
||||
AnchorTarget::Parent => Some("_parent"),
|
||||
|
|
@ -78,9 +78,9 @@ impl ComponentTrait for Anchor {
|
|||
href=[self.href().get()]
|
||||
target=[target]
|
||||
{
|
||||
(self.left_icon().render(rcx))
|
||||
(" ") span { (self.html().render(rcx)) } (" ")
|
||||
(self.right_icon().render(rcx))
|
||||
(self.left_icon().prepare(rcx))
|
||||
(" ") span { (self.html().prepare(rcx)) } (" ")
|
||||
(self.right_icon().prepare(rcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pagetop::prelude::*;
|
|||
|
||||
use_handle!(COMPONENT_CONTAINER);
|
||||
|
||||
action_before_render_component!(ACTION_BEFORE_RENDER_CONTAINER for Container);
|
||||
action_before_prepare_component!(ACTION_BEFORE_PREPARE_CONTAINER for Container);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum ContainerType {
|
||||
|
|
@ -50,43 +50,43 @@ impl ComponentTrait for Container {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn before_render(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_render_component(self, rcx);
|
||||
fn before_prepare(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_prepare_component(self, rcx);
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
match self.container_type() {
|
||||
ContainerType::Header => html! {
|
||||
header id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().render(rcx))
|
||||
(self.components().prepare(rcx))
|
||||
}
|
||||
}
|
||||
},
|
||||
ContainerType::Footer => html! {
|
||||
footer id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().render(rcx))
|
||||
(self.components().prepare(rcx))
|
||||
}
|
||||
}
|
||||
},
|
||||
ContainerType::Main => html! {
|
||||
main id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().render(rcx))
|
||||
(self.components().prepare(rcx))
|
||||
}
|
||||
}
|
||||
},
|
||||
ContainerType::Section => html! {
|
||||
section id=[self.id()] class=[self.classes().get()] {
|
||||
div class=[self.inner_classes().get()] {
|
||||
(self.components().render(rcx))
|
||||
(self.components().prepare(rcx))
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => html! {
|
||||
div id=[self.id()] class=[self.classes().get()] {
|
||||
(self.components().render(rcx))
|
||||
(self.components().prepare(rcx))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,24 +45,25 @@ impl ComponentTrait for Button {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
let button_type = match self.button_type() {
|
||||
ButtonType::Button => "button",
|
||||
ButtonType::Submit => "submit",
|
||||
ButtonType::Reset => "reset",
|
||||
};
|
||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
let value = self.value().prepare(rcx);
|
||||
html! {
|
||||
button
|
||||
type=(button_type)
|
||||
id=[id]
|
||||
class=[self.classes().get()]
|
||||
name=[self.name().get()]
|
||||
value=(self.value().render(rcx))
|
||||
value=(value)
|
||||
autofocus=[self.autofocus().get()]
|
||||
disabled=[self.disabled().get()]
|
||||
{
|
||||
(self.value().render(rcx))
|
||||
(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ impl ComponentTrait for Date {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
html! {
|
||||
div class=[self.classes().get()] {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pagetop::prelude::*;
|
|||
|
||||
use_handle!(COMPONENT_FORM);
|
||||
|
||||
action_before_render_component!(ACTION_BEFORE_RENDER_FORM for Form);
|
||||
action_before_prepare_component!(ACTION_BEFORE_PREPARE_FORM for Form);
|
||||
|
||||
#[derive(Default)]
|
||||
pub enum FormMethod {
|
||||
|
|
@ -48,11 +48,11 @@ impl ComponentTrait for Form {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn before_render(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_render_component(self, rcx);
|
||||
fn before_prepare(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_prepare_component(self, rcx);
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
let method = match self.method() {
|
||||
FormMethod::Post => Some("post".to_owned()),
|
||||
FormMethod::Get => None,
|
||||
|
|
@ -65,7 +65,7 @@ impl ComponentTrait for Form {
|
|||
method=[method]
|
||||
accept-charset=[self.charset().get()]
|
||||
{
|
||||
div { (self.elements().render(rcx)) }
|
||||
div { (self.elements().prepare(rcx)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ impl ComponentTrait for Hidden {
|
|||
self.weight
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
||||
let id = self.name().get().map(|name| concat_string!("value-", name));
|
||||
html! {
|
||||
input type="hidden" id=[id] name=[self.name().get()] value=[self.value().get()];
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ impl ComponentTrait for Input {
|
|||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
let type_input = match self.input_type() {
|
||||
InputType::Textfield => "text",
|
||||
InputType::Password => "password",
|
||||
|
|
@ -73,7 +73,7 @@ impl ComponentTrait for Input {
|
|||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||
html! {
|
||||
div class=[self.classes().get()] {
|
||||
@if let Some(label) = self.label().optional_render(rcx) {
|
||||
@if let Some(label) = self.label().prepare_optional(rcx) {
|
||||
label class="form-label" for=[&id] {
|
||||
(label) " "
|
||||
@if self.required().get().is_some() {
|
||||
|
|
@ -98,7 +98,7 @@ impl ComponentTrait for Input {
|
|||
readonly=[self.readonly().get()]
|
||||
required=[self.required().get()]
|
||||
disabled=[self.disabled().get()];
|
||||
@if let Some(description) = self.help_text().optional_render(rcx) {
|
||||
@if let Some(description) = self.help_text().prepare_optional(rcx) {
|
||||
div class="form-text" { (description) }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use pagetop::prelude::*;
|
|||
|
||||
use_handle!(COMPONENT_COLUMN);
|
||||
|
||||
action_before_render_component!(ACTION_BEFORE_RENDER_COLUMN for Column);
|
||||
action_before_prepare_component!(ACTION_BEFORE_PREPARE_COLUMN for Column);
|
||||
|
||||
const SIZE__DEFAULT: &str = "col-md";
|
||||
const SIZE__1_OF_12: &str = "col-md-1";
|
||||
|
|
@ -69,14 +69,14 @@ impl ComponentTrait for Column {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn before_render(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_render_component(self, rcx);
|
||||
fn before_prepare(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_prepare_component(self, rcx);
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
html! {
|
||||
div id=[self.id()] class=[self.classes().get()] {
|
||||
(self.components().render(rcx))
|
||||
(self.components().prepare(rcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use crate::component::grid;
|
|||
|
||||
use_handle!(COMPONENT_ROW);
|
||||
|
||||
action_before_render_component!(ACTION_BEFORE_RENDER_ROW for Row);
|
||||
action_before_prepare_component!(ACTION_BEFORE_PREPARE_ROW for Row);
|
||||
|
||||
#[rustfmt::skip]
|
||||
#[derive(Default)]
|
||||
|
|
@ -38,14 +38,14 @@ impl ComponentTrait for Row {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn before_render(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_render_component(self, rcx);
|
||||
fn before_prepare(&mut self, rcx: &mut RenderContext) {
|
||||
run_actions_before_prepare_component(self, rcx);
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
html! {
|
||||
div id=[self.id()] class=[self.classes().get()] {
|
||||
(self.columns().render(rcx))
|
||||
(self.columns().prepare(rcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,16 +61,16 @@ impl ComponentTrait for Heading {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
let id = self.id();
|
||||
let classes = self.classes().get();
|
||||
html! { @match &self.heading_type() {
|
||||
HeadingType::H1 => h1 id=[id] class=[classes] { (self.text().render(rcx)) },
|
||||
HeadingType::H2 => h2 id=[id] class=[classes] { (self.text().render(rcx)) },
|
||||
HeadingType::H3 => h3 id=[id] class=[classes] { (self.text().render(rcx)) },
|
||||
HeadingType::H4 => h4 id=[id] class=[classes] { (self.text().render(rcx)) },
|
||||
HeadingType::H5 => h5 id=[id] class=[classes] { (self.text().render(rcx)) },
|
||||
HeadingType::H6 => h6 id=[id] class=[classes] { (self.text().render(rcx)) },
|
||||
HeadingType::H1 => h1 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||
HeadingType::H2 => h2 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||
HeadingType::H3 => h3 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||
HeadingType::H4 => h4 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||
HeadingType::H5 => h5 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||
HeadingType::H6 => h6 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
||||
}}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ impl ComponentTrait for Icon {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn before_render(&mut self, rcx: &mut RenderContext) {
|
||||
fn before_prepare(&mut self, rcx: &mut RenderContext) {
|
||||
rcx.alter(ContextOp::AddStyleSheet(
|
||||
StyleSheet::located("/minimal/icons/bootstrap-icons.css").with_version("1.8.2"),
|
||||
));
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
||||
html! { i class=[self.classes().get()] {}; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ impl ComponentTrait for Image {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn default_render(&self, _: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, _: &mut RenderContext) -> Markup {
|
||||
html! {
|
||||
img
|
||||
src=[self.source().get()]
|
||||
|
|
|
|||
|
|
@ -46,13 +46,13 @@ impl ComponentTrait for Paragraph {
|
|||
(self.renderable.check)(rcx)
|
||||
}
|
||||
|
||||
fn default_render(&self, rcx: &mut RenderContext) -> Markup {
|
||||
fn prepare_component(&self, rcx: &mut RenderContext) -> Markup {
|
||||
html! {
|
||||
p
|
||||
id=[self.id()]
|
||||
class=[self.classes().get()]
|
||||
{
|
||||
(self.components().render(rcx))
|
||||
(self.components().prepare(rcx))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue