Modifica la fuente de los activos globales

This commit is contained in:
Manuel Cillero 2022-05-15 22:18:28 +02:00
parent 9f6b790a9d
commit 18bec0543c
7 changed files with 13 additions and 21 deletions

View file

@ -208,13 +208,13 @@ impl ComponentTrait for Menu {
fn default_render(&self, context: &mut InContext) -> Markup { fn default_render(&self, context: &mut InContext) -> Markup {
context context
.add_stylesheet(StyleSheet::source( .add_stylesheet(StyleSheet::with_source(
"/theme/menu/css/menu.css?ver=1.1.1" "/theme/menu/css/menu.css?ver=1.1.1"
)) ))
.add_stylesheet(StyleSheet::source( .add_stylesheet(StyleSheet::with_source(
"/theme/menu/css/menu-clean.css?ver=1.1.1" "/theme/menu/css/menu-clean.css?ver=1.1.1"
)) ))
.add_javascript(JavaScript::source( .add_javascript(JavaScript::with_source(
"/theme/menu/js/menu.min.js?ver=1.1.1" "/theme/menu/js/menu.min.js?ver=1.1.1"
)) ))
.add_jquery(); .add_jquery();

View file

@ -22,7 +22,7 @@ impl ThemeTrait for Aliner {
.with_icon("/theme/favicon.png") .with_icon("/theme/favicon.png")
) )
.add_stylesheet( .add_stylesheet(
StyleSheet::source( StyleSheet::with_source(
"/aliner/css/styles.css" "/aliner/css/styles.css"
) )
.with_weight(-99) .with_weight(-99)

View file

@ -24,13 +24,13 @@ impl ThemeTrait for Bootsier {
.with_icon("/theme/favicon.png") .with_icon("/theme/favicon.png")
) )
.add_stylesheet( .add_stylesheet(
StyleSheet::source( StyleSheet::with_source(
"/bootsier/css/bootstrap.min.css?ver=5.1.3" "/bootsier/css/bootstrap.min.css?ver=5.1.3"
) )
.with_weight(-99) .with_weight(-99)
) )
.add_javascript( .add_javascript(
JavaScript::source( JavaScript::with_source(
"/bootsier/js/bootstrap.bundle.min.js?ver=5.1.3" "/bootsier/js/bootstrap.bundle.min.js?ver=5.1.3"
) )
.with_weight(-99) .with_weight(-99)

View file

@ -22,7 +22,7 @@ impl ThemeTrait for Bulmix {
.with_icon("/theme/favicon.png") .with_icon("/theme/favicon.png")
) )
.add_stylesheet( .add_stylesheet(
StyleSheet::source( StyleSheet::with_source(
"/bulmix/css/bulma.min.css?ver=0.9.3" "/bulmix/css/bulma.min.css?ver=0.9.3"
) )
.with_weight(-99) .with_weight(-99)

View file

@ -101,7 +101,7 @@ pub struct JavaScript {
mode : JSMode, mode : JSMode,
} }
impl JavaScript { impl JavaScript {
pub fn source(s: &'static str) -> Self { pub fn with_source(s: &'static str) -> Self {
JavaScript { JavaScript {
source: s, source: s,
weight: 0, weight: 0,
@ -119,11 +119,7 @@ impl JavaScript {
self self
} }
pub fn weight(self) -> isize { fn render(&self) -> Markup {
self.weight
}
pub fn render(&self) -> Markup {
html! { html! {
script type="text/javascript" script type="text/javascript"
src=(self.source) src=(self.source)
@ -141,7 +137,7 @@ pub struct StyleSheet {
weight: isize, weight: isize,
} }
impl StyleSheet { impl StyleSheet {
pub fn source(s: &'static str) -> Self { pub fn with_source(s: &'static str) -> Self {
StyleSheet { StyleSheet {
source: s, source: s,
weight: 0, weight: 0,
@ -153,10 +149,6 @@ impl StyleSheet {
self self
} }
pub fn weight(self) -> isize {
self.weight
}
fn render(&self) -> Markup { fn render(&self) -> Markup {
html! { html! {
link rel="stylesheet" href=(self.source); link rel="stylesheet" href=(self.source);
@ -234,7 +226,7 @@ impl InContext {
pub fn add_jquery(&mut self) -> &mut Self { pub fn add_jquery(&mut self) -> &mut Self {
if !self.with_jquery { if !self.with_jquery {
self.add_javascript( self.add_javascript(
JavaScript::source( JavaScript::with_source(
"/theme/js/jquery.min.js?ver=3.6.0" "/theme/js/jquery.min.js?ver=3.6.0"
) )
.with_weight(isize::MIN) .with_weight(isize::MIN)

View file

@ -55,7 +55,7 @@ pub fn render_component(component: &mut dyn ComponentTrait, context: &mut InCont
// Acciones de los módulos antes de renderizar el componente. // Acciones de los módulos antes de renderizar el componente.
run_hooks( run_hooks(
BEFORE_RENDER_COMPONENT_HOOK, BEFORE_RENDER_COMPONENT_HOOK,
|a| hook_ref::<BeforeRenderComponentHook>(&**a).run(component, context) |hook| hook_ref::<BeforeRenderComponentHook>(&**hook).run(component, context)
); );
// Acciones del tema antes de renderizar el componente. // Acciones del tema antes de renderizar el componente.

View file

@ -153,7 +153,7 @@ impl<'a> Page<'a> {
// Acciones de los módulos antes de renderizar la página. // Acciones de los módulos antes de renderizar la página.
run_hooks( run_hooks(
BEFORE_RENDER_PAGE_HOOK, BEFORE_RENDER_PAGE_HOOK,
|a| hook_ref::<BeforeRenderPageHook>(&**a).run(self) |hook| hook_ref::<BeforeRenderPageHook>(&**hook).run(self)
); );
// Acciones del tema antes de renderizar la página. // Acciones del tema antes de renderizar la página.