👽️ Aplica cambio de API para Context
This commit is contained in:
parent
a1d51d6d0f
commit
9552ae0af5
17 changed files with 96 additions and 100 deletions
|
|
@ -115,11 +115,7 @@ impl ThemeTrait for Bootsier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render_component(
|
fn render_component(&self, component: &dyn ComponentTrait, cx: &mut Context) -> Option<Markup> {
|
||||||
&self,
|
|
||||||
component: &dyn ComponentTrait,
|
|
||||||
rcx: &mut RenderContext,
|
|
||||||
) -> Option<Markup> {
|
|
||||||
match component.handle() {
|
match component.handle() {
|
||||||
ERROR_404 => Some(html! {
|
ERROR_404 => Some(html! {
|
||||||
div class="jumbotron" {
|
div class="jumbotron" {
|
||||||
|
|
@ -132,18 +128,18 @@ impl ThemeTrait for Bootsier {
|
||||||
div class="media-body" {
|
div class="media-body" {
|
||||||
h1 class="display-4" { ("RESOURCE NOT FOUND") }
|
h1 class="display-4" { ("RESOURCE NOT FOUND") }
|
||||||
p class="lead" {
|
p class="lead" {
|
||||||
(L10n::t("e404-description", &LOCALE_BOOTSIER).prepare(rcx))
|
(L10n::t("e404-description", &LOCALE_BOOTSIER).prepare(cx))
|
||||||
}
|
}
|
||||||
hr class="my-4";
|
hr class="my-4";
|
||||||
p {
|
p {
|
||||||
(L10n::t("e404-description", &LOCALE_BOOTSIER).prepare(rcx))
|
(L10n::t("e404-description", &LOCALE_BOOTSIER).prepare(cx))
|
||||||
}
|
}
|
||||||
a
|
a
|
||||||
class="btn btn-primary btn-lg"
|
class="btn btn-primary btn-lg"
|
||||||
href="/"
|
href="/"
|
||||||
role="button"
|
role="button"
|
||||||
{
|
{
|
||||||
(L10n::t("back-homepage", &LOCALE_BOOTSIER).prepare(rcx))
|
(L10n::t("back-homepage", &LOCALE_BOOTSIER).prepare(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ impl ThemeTrait for Bulmix {
|
||||||
fn before_prepare_component(
|
fn before_prepare_component(
|
||||||
&self,
|
&self,
|
||||||
component: &mut dyn ComponentTrait,
|
component: &mut dyn ComponentTrait,
|
||||||
_rcx: &mut RenderContext,
|
_cx: &mut Context,
|
||||||
) {
|
) {
|
||||||
match component.handle() {
|
match component.handle() {
|
||||||
COMPONENT_ANCHOR => {
|
COMPONENT_ANCHOR => {
|
||||||
|
|
@ -122,7 +122,7 @@ impl ThemeTrait for Bulmix {
|
||||||
fn render_component(
|
fn render_component(
|
||||||
&self,
|
&self,
|
||||||
component: &dyn ComponentTrait,
|
component: &dyn ComponentTrait,
|
||||||
_rcx: &mut RenderContext,
|
_cx: &mut Context,
|
||||||
) -> Option<Markup> {
|
) -> Option<Markup> {
|
||||||
match component.handle() {
|
match component.handle() {
|
||||||
COMPONENT_ICON => {
|
COMPONENT_ICON => {
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,12 @@ impl ModuleTrait for JQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JQuery {
|
impl JQuery {
|
||||||
pub fn add_in(rcx: &mut RenderContext) {
|
pub fn add_in(cx: &mut Context) {
|
||||||
rcx.set_param::<bool>(JQUERY_PARAM, true);
|
cx.set_param::<bool>(JQUERY_PARAM, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_from(rcx: &mut RenderContext) {
|
pub fn remove_from(cx: &mut Context) {
|
||||||
rcx.set_param::<bool>(JQUERY_PARAM, false);
|
cx.set_param::<bool>(JQUERY_PARAM, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,33 +41,33 @@ impl ComponentTrait for MegaMenuItem {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
match self.item_type() {
|
match self.item_type() {
|
||||||
MegaMenuItemType::Void => PrepareMarkup::None,
|
MegaMenuItemType::Void => PrepareMarkup::None,
|
||||||
|
|
||||||
MegaMenuItemType::Label(label) => PrepareMarkup::With(html! {
|
MegaMenuItemType::Label(label) => PrepareMarkup::With(html! {
|
||||||
li class="label" { a href="#" { (label.prepare(rcx)) } }
|
li class="label" { a href="#" { (label.prepare(cx)) } }
|
||||||
}),
|
}),
|
||||||
MegaMenuItemType::Link(label, path) => PrepareMarkup::With(html! {
|
MegaMenuItemType::Link(label, path) => PrepareMarkup::With(html! {
|
||||||
li class="link" { a href=(path) { (label.prepare(rcx)) } }
|
li class="link" { a href=(path) { (label.prepare(cx)) } }
|
||||||
}),
|
}),
|
||||||
MegaMenuItemType::LinkBlank(label, path) => PrepareMarkup::With(html! {
|
MegaMenuItemType::LinkBlank(label, path) => PrepareMarkup::With(html! {
|
||||||
li class="link_blank" {
|
li class="link_blank" {
|
||||||
a href=(path) target="_blank" { (label.prepare(rcx)) }
|
a href=(path) target="_blank" { (label.prepare(cx)) }
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
MegaMenuItemType::Html(content) => PrepareMarkup::With(html! {
|
MegaMenuItemType::Html(content) => PrepareMarkup::With(html! {
|
||||||
li class="html" { (content.prepare(rcx)) }
|
li class="html" { (content.prepare(cx)) }
|
||||||
}),
|
}),
|
||||||
MegaMenuItemType::Submenu(label, menu) => PrepareMarkup::With(html! {
|
MegaMenuItemType::Submenu(label, menu) => PrepareMarkup::With(html! {
|
||||||
li class="submenu" {
|
li class="submenu" {
|
||||||
a href="#" { (label.prepare(rcx)) }
|
a href="#" { (label.prepare(cx)) }
|
||||||
ul {
|
ul {
|
||||||
(menu.items().prepare(rcx))
|
(menu.items().prepare(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
@ -184,16 +184,16 @@ impl ComponentTrait for MegaMenu {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, rcx: &mut RenderContext) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
rcx.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
cx.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
||||||
"/megamenu/css/menu.css?v=1.1.1",
|
"/megamenu/css/menu.css?v=1.1.1",
|
||||||
)))
|
)))
|
||||||
.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
||||||
|
|
@ -202,13 +202,13 @@ impl ComponentTrait for MegaMenu {
|
||||||
.alter(ContextOp::AddJavaScript(JavaScript::located(
|
.alter(ContextOp::AddJavaScript(JavaScript::located(
|
||||||
"/megamenu/js/menu.min.js?v=1.1.1",
|
"/megamenu/js/menu.min.js?v=1.1.1",
|
||||||
)));
|
)));
|
||||||
JQuery::add_in(rcx);
|
JQuery::add_in(cx);
|
||||||
|
|
||||||
let id = rcx.required_id::<MegaMenu>(self.id());
|
let id = cx.required_id::<MegaMenu>(self.id());
|
||||||
|
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
ul id=(id) class=[self.classes().get()] {
|
ul id=(id) class=[self.classes().get()] {
|
||||||
(self.items().prepare(rcx))
|
(self.items().prepare(cx))
|
||||||
}
|
}
|
||||||
script type="text/javascript" defer {
|
script type="text/javascript" defer {
|
||||||
"jQuery(function(){jQuery('#" (id) "').smartmenus({"
|
"jQuery(function(){jQuery('#" (id) "').smartmenus({"
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,12 @@ impl ComponentTrait for Anchor {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
let target = match &self.target() {
|
let target = match &self.target() {
|
||||||
AnchorTarget::Blank => Some("_blank"),
|
AnchorTarget::Blank => Some("_blank"),
|
||||||
AnchorTarget::Parent => Some("_parent"),
|
AnchorTarget::Parent => Some("_parent"),
|
||||||
|
|
@ -78,9 +78,9 @@ impl ComponentTrait for Anchor {
|
||||||
href=[self.href().get()]
|
href=[self.href().get()]
|
||||||
target=[target]
|
target=[target]
|
||||||
{
|
{
|
||||||
(self.left_icon().prepare(rcx))
|
(self.left_icon().prepare(cx))
|
||||||
(" ") span { (self.html().prepare(rcx)) } (" ")
|
(" ") span { (self.html().prepare(cx)) } (" ")
|
||||||
(self.right_icon().prepare(rcx))
|
(self.right_icon().prepare(cx))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,47 +46,47 @@ impl ComponentTrait for Container {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, rcx: &mut RenderContext) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
match self.container_type() {
|
match self.container_type() {
|
||||||
ContainerType::Header => PrepareMarkup::With(html! {
|
ContainerType::Header => PrepareMarkup::With(html! {
|
||||||
header id=[self.id()] class=[self.classes().get()] {
|
header id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
ContainerType::Footer => PrepareMarkup::With(html! {
|
ContainerType::Footer => PrepareMarkup::With(html! {
|
||||||
footer id=[self.id()] class=[self.classes().get()] {
|
footer id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
ContainerType::Main => PrepareMarkup::With(html! {
|
ContainerType::Main => PrepareMarkup::With(html! {
|
||||||
main id=[self.id()] class=[self.classes().get()] {
|
main id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
ContainerType::Section => PrepareMarkup::With(html! {
|
ContainerType::Section => PrepareMarkup::With(html! {
|
||||||
section id=[self.id()] class=[self.classes().get()] {
|
section id=[self.id()] class=[self.classes().get()] {
|
||||||
div class=[self.inner_classes().get()] {
|
div class=[self.inner_classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
_ => PrepareMarkup::With(html! {
|
_ => PrepareMarkup::With(html! {
|
||||||
div id=[self.id()] class=[self.classes().get()] {
|
div id=[self.id()] class=[self.classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(cx))
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,18 +41,18 @@ impl ComponentTrait for Button {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
let button_type = match self.button_type() {
|
let button_type = match self.button_type() {
|
||||||
ButtonType::Button => "button",
|
ButtonType::Button => "button",
|
||||||
ButtonType::Submit => "submit",
|
ButtonType::Submit => "submit",
|
||||||
ButtonType::Reset => "reset",
|
ButtonType::Reset => "reset",
|
||||||
};
|
};
|
||||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||||
let value = self.value().prepare(rcx);
|
let value = self.value().prepare(cx);
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
button
|
button
|
||||||
type=(button_type)
|
type=(button_type)
|
||||||
|
|
|
||||||
|
|
@ -36,11 +36,11 @@ impl ComponentTrait for Date {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, _: &mut Context) -> PrepareMarkup {
|
||||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
div class=[self.classes().get()] {
|
div class=[self.classes().get()] {
|
||||||
|
|
|
||||||
|
|
@ -44,15 +44,15 @@ impl ComponentTrait for Form {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, rcx: &mut RenderContext) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
let method = match self.method() {
|
let method = match self.method() {
|
||||||
FormMethod::Post => Some("post".to_owned()),
|
FormMethod::Post => Some("post".to_owned()),
|
||||||
FormMethod::Get => None,
|
FormMethod::Get => None,
|
||||||
|
|
@ -65,7 +65,7 @@ impl ComponentTrait for Form {
|
||||||
method=[method]
|
method=[method]
|
||||||
accept-charset=[self.charset().get()]
|
accept-charset=[self.charset().get()]
|
||||||
{
|
{
|
||||||
div { (self.elements().prepare(rcx)) }
|
div { (self.elements().prepare(cx)) }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl ComponentTrait for Hidden {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, _: &mut Context) -> PrepareMarkup {
|
||||||
let id = self.name().get().map(|name| concat_string!("value-", name));
|
let id = self.name().get().map(|name| concat_string!("value-", name));
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
input type="hidden" id=[id] name=[self.name().get()] value=[self.value().get()];
|
input type="hidden" id=[id] name=[self.name().get()] value=[self.value().get()];
|
||||||
|
|
|
||||||
|
|
@ -56,12 +56,12 @@ impl ComponentTrait for Input {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
let type_input = match self.input_type() {
|
let type_input = match self.input_type() {
|
||||||
InputType::Textfield => "text",
|
InputType::Textfield => "text",
|
||||||
InputType::Password => "password",
|
InputType::Password => "password",
|
||||||
|
|
@ -71,8 +71,8 @@ impl ComponentTrait for Input {
|
||||||
InputType::Url => "url",
|
InputType::Url => "url",
|
||||||
};
|
};
|
||||||
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
let id = self.name().get().map(|name| concat_string!("edit-", name));
|
||||||
let label = self.label().prepare(rcx);
|
let label = self.label().prepare(cx);
|
||||||
let description = self.help_text().prepare(rcx);
|
let description = self.help_text().prepare(cx);
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
div class=[self.classes().get()] {
|
div class=[self.classes().get()] {
|
||||||
@if !label.is_empty() {
|
@if !label.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -65,18 +65,18 @@ impl ComponentTrait for Column {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, rcx: &mut RenderContext) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
div id=[self.id()] class=[self.classes().get()] {
|
div id=[self.id()] class=[self.classes().get()] {
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(cx))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,18 +34,18 @@ impl ComponentTrait for Row {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, rcx: &mut RenderContext) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
run_actions_before_prepare_component(self, rcx);
|
run_actions_before_prepare_component(self, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
div id=[self.id()] class=[self.classes().get()] {
|
div id=[self.id()] class=[self.classes().get()] {
|
||||||
(self.columns().prepare(rcx))
|
(self.columns().prepare(cx))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,20 +57,20 @@ impl ComponentTrait for Heading {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
let id = self.id();
|
let id = self.id();
|
||||||
let classes = self.classes().get();
|
let classes = self.classes().get();
|
||||||
PrepareMarkup::With(html! { @match &self.heading_type() {
|
PrepareMarkup::With(html! { @match &self.heading_type() {
|
||||||
HeadingType::H1 => h1 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H1 => h1 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||||
HeadingType::H2 => h2 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H2 => h2 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||||
HeadingType::H3 => h3 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H3 => h3 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||||
HeadingType::H4 => h4 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H4 => h4 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||||
HeadingType::H5 => h5 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H5 => h5 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||||
HeadingType::H6 => h6 id=[id] class=[classes] { (self.text().prepare(rcx)) },
|
HeadingType::H6 => h6 id=[id] class=[classes] { (self.text().prepare(cx)) },
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,17 @@ impl ComponentTrait for Icon {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, rcx: &mut RenderContext) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
rcx.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
cx.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
||||||
"/minimal/icons/bootstrap-icons.css?v=1.8.2",
|
"/minimal/icons/bootstrap-icons.css?v=1.8.2",
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, _: &mut Context) -> PrepareMarkup {
|
||||||
PrepareMarkup::With(html! { i class=[self.classes().get()] {}; })
|
PrepareMarkup::With(html! { i class=[self.classes().get()] {}; })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,11 +30,11 @@ impl ComponentTrait for Image {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, _: &mut Context) -> PrepareMarkup {
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
img
|
img
|
||||||
src=[self.source().get()]
|
src=[self.source().get()]
|
||||||
|
|
|
||||||
|
|
@ -42,17 +42,17 @@ impl ComponentTrait for Paragraph {
|
||||||
self.weight
|
self.weight
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_renderable(&self, rcx: &RenderContext) -> bool {
|
fn is_renderable(&self, cx: &Context) -> bool {
|
||||||
(self.renderable.check)(rcx)
|
(self.renderable.check)(cx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, rcx: &mut RenderContext) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
PrepareMarkup::With(html! {
|
PrepareMarkup::With(html! {
|
||||||
p
|
p
|
||||||
id=[self.id()]
|
id=[self.id()]
|
||||||
class=[self.classes().get()]
|
class=[self.classes().get()]
|
||||||
{
|
{
|
||||||
(self.components().prepare(rcx))
|
(self.components().prepare(cx))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue