⏪ Recupera la versión con valor propio en activos
This commit is contained in:
parent
4673b82a93
commit
f85a35b5f4
5 changed files with 33 additions and 25 deletions
|
|
@ -46,13 +46,16 @@ impl ThemeTrait for Bootsier {
|
||||||
fn before_prepare_page(&self, page: &mut Page) {
|
fn before_prepare_page(&self, page: &mut Page) {
|
||||||
page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico")))
|
page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico")))
|
||||||
.alter_context(ContextOp::AddStyleSheet(
|
.alter_context(ContextOp::AddStyleSheet(
|
||||||
StyleSheet::located("/bootsier/css/bootstrap.min.css?v=5.1.3").with_weight(-99),
|
StyleSheet::located("/bootsier/css/bootstrap.min.css")
|
||||||
|
.with_version("5.1.3")
|
||||||
|
.with_weight(-99),
|
||||||
))
|
))
|
||||||
.alter_context(ContextOp::AddJavaScript(
|
.alter_context(ContextOp::AddJavaScript(
|
||||||
JavaScript::located("/bootsier/js/bootstrap.bundle.min.js?v=5.1.3")
|
JavaScript::located("/bootsier/js/bootstrap.bundle.min.js")
|
||||||
|
.with_version("5.1.3")
|
||||||
.with_weight(-99),
|
.with_weight(-99),
|
||||||
));
|
));
|
||||||
JQuery::add_in(page.context());
|
JQuery.enable_jquery(page.context());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_page_body(&self, page: &mut Page) -> Markup {
|
fn prepare_page_body(&self, page: &mut Page) -> Markup {
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,11 @@ impl ThemeTrait for Bulmix {
|
||||||
fn before_prepare_page(&self, page: &mut Page) {
|
fn before_prepare_page(&self, page: &mut Page) {
|
||||||
page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico")))
|
page.alter_favicon(Some(Favicon::new().with_icon("/theme/favicon.ico")))
|
||||||
.alter_context(ContextOp::AddStyleSheet(
|
.alter_context(ContextOp::AddStyleSheet(
|
||||||
StyleSheet::located("/bulmix/css/bulma.min.css?v=0.9.4").with_weight(-99),
|
StyleSheet::located("/bulmix/css/bulma.min.css")
|
||||||
|
.with_version("0.9.4")
|
||||||
|
.with_weight(-99),
|
||||||
));
|
));
|
||||||
JQuery::add_in(page.context());
|
JQuery.enable_jquery(page.context());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use_locale!(LOCALE_JQUERY);
|
||||||
|
|
||||||
use_static!(jquery);
|
use_static!(jquery);
|
||||||
|
|
||||||
const JQUERY_PARAM: &str = "jquery.add";
|
const PARAM_JQUERY: &str = "jquery.js";
|
||||||
|
|
||||||
pub struct JQuery;
|
pub struct JQuery;
|
||||||
|
|
||||||
|
|
@ -33,19 +33,22 @@ impl ModuleTrait for JQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JQuery {
|
impl JQuery {
|
||||||
pub fn add_in(cx: &mut Context) {
|
pub fn enable_jquery(&self, cx: &mut Context) -> &Self {
|
||||||
cx.set_param::<bool>(JQUERY_PARAM, true);
|
cx.set_param::<bool>(PARAM_JQUERY, true);
|
||||||
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn remove_from(cx: &mut Context) {
|
pub fn disable_jquery(&self, cx: &mut Context) -> &Self {
|
||||||
cx.set_param::<bool>(JQUERY_PARAM, false);
|
cx.set_param::<bool>(PARAM_JQUERY, false);
|
||||||
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_render_page(page: &mut Page) {
|
fn before_render_page(page: &mut Page) {
|
||||||
if let Some(true) = page.context().get_param::<bool>(JQUERY_PARAM) {
|
if let Some(true) = page.context().get_param::<bool>(PARAM_JQUERY) {
|
||||||
page.context().alter(ContextOp::AddJavaScript(
|
page.context().alter(ContextOp::AddJavaScript(
|
||||||
JavaScript::located("/jquery/jquery.min.js?v=3.6.0")
|
JavaScript::located("/jquery/jquery.min.js")
|
||||||
|
.with_version("3.6.0")
|
||||||
.with_weight(isize::MIN)
|
.with_weight(isize::MIN)
|
||||||
.with_mode(ModeJS::Normal),
|
.with_mode(ModeJS::Normal),
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -193,16 +193,16 @@ impl ComponentTrait for MegaMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
fn prepare_component(&self, cx: &mut Context) -> PrepareMarkup {
|
||||||
cx.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
cx.alter(ContextOp::AddStyleSheet(
|
||||||
"/megamenu/css/menu.css?v=1.1.1",
|
StyleSheet::located("/megamenu/css/menu.css").with_version("1.1.1"),
|
||||||
)))
|
))
|
||||||
.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
.alter(ContextOp::AddStyleSheet(
|
||||||
"/megamenu/css/menu-clean.css?v=1.1.1",
|
StyleSheet::located("/megamenu/css/menu-clean.css").with_version("1.1.1"),
|
||||||
)))
|
))
|
||||||
.alter(ContextOp::AddJavaScript(JavaScript::located(
|
.alter(ContextOp::AddJavaScript(
|
||||||
"/megamenu/js/menu.min.js?v=1.1.1",
|
JavaScript::located("/megamenu/js/menu.min.js").with_version("1.1.1"),
|
||||||
)));
|
));
|
||||||
JQuery::add_in(cx);
|
JQuery.enable_jquery(cx);
|
||||||
|
|
||||||
let id = cx.required_id::<MegaMenu>(self.id());
|
let id = cx.required_id::<MegaMenu>(self.id());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ impl ComponentTrait for Icon {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn before_prepare_component(&mut self, cx: &mut Context) {
|
fn before_prepare_component(&mut self, cx: &mut Context) {
|
||||||
cx.alter(ContextOp::AddStyleSheet(StyleSheet::located(
|
cx.alter(ContextOp::AddStyleSheet(
|
||||||
"/minimal/icons/bootstrap-icons.css?v=1.8.2",
|
StyleSheet::located("/minimal/icons/bootstrap-icons.css").with_version("1.8.2"),
|
||||||
)));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn prepare_component(&self, _: &mut Context) -> PrepareMarkup {
|
fn prepare_component(&self, _: &mut Context) -> PrepareMarkup {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue