🩹 Fix styles location for Inception theme

This commit is contained in:
Manuel Cillero 2023-10-16 20:38:12 +02:00
parent 2015bb77f0
commit 62951befda
5 changed files with 11 additions and 12 deletions

View file

@ -31,10 +31,6 @@ pub(crate) fn add_assets_for_base(cx: &mut Context) {
JavaScript::at("/base/js/menu.js").with_version("0.0.1"),
));
}
cx.alter(ContextOp::AddStyleSheet(
StyleSheet::at("/base/css/styles.css").with_version("0.0.1"),
));
}
// By default, 1 pixel = 0.0625em.

View file

@ -1,2 +1,2 @@
mod inception;
pub use inception::{InceptionTheme, THEME_INCEPTION};
pub use inception::{Inception, THEME_INCEPTION};

View file

@ -4,9 +4,9 @@ new_handle!(THEME_INCEPTION);
static_files!(base);
pub struct InceptionTheme;
pub struct Inception;
impl ModuleTrait for InceptionTheme {
impl ModuleTrait for Inception {
fn handle(&self) -> Handle {
THEME_INCEPTION
}
@ -16,7 +16,7 @@ impl ModuleTrait for InceptionTheme {
}
fn theme(&self) -> Option<ThemeRef> {
Some(&InceptionTheme)
Some(&Inception)
}
fn configure_service(&self, scfg: &mut service::web::ServiceConfig) {
@ -24,7 +24,7 @@ impl ModuleTrait for InceptionTheme {
}
}
impl ThemeTrait for InceptionTheme {
impl ThemeTrait for Inception {
fn after_prepare_body(&self, page: &mut Page) {
page.alter_favicon(Some(Favicon::new().with_icon("/base/favicon.ico")))
.alter_context(ContextOp::AddStyleSheet(
@ -32,6 +32,9 @@ impl ThemeTrait for InceptionTheme {
.with_version("8.0.1")
.with_weight(-99),
))
.alter_context(ContextOp::AddAssetsForBase);
.alter_context(ContextOp::AddAssetsForBase)
.alter_context(ContextOp::AddStyleSheet(
StyleSheet::at("/base/css/styles.css").with_version("0.0.1"),
));
}
}

View file

@ -28,7 +28,7 @@ pub fn register_modules(app: ModuleRef) {
let mut list: Vec<ModuleRef> = Vec::new();
// Enable default theme.
add_to_enabled(&mut list, &crate::base::theme::InceptionTheme);
add_to_enabled(&mut list, &crate::base::theme::Inception);
// Enable application modules.
add_to_enabled(&mut list, app);

View file

@ -13,7 +13,7 @@ pub static THEMES: LazyStatic<RwLock<Vec<ThemeRef>>> = LazyStatic::new(|| RwLock
pub static THEME: LazyStatic<ThemeRef> =
LazyStatic::new(|| match theme_by_single_name(&config::SETTINGS.app.theme) {
Some(theme) => theme,
None => &crate::base::theme::InceptionTheme,
None => &crate::base::theme::Inception,
});
// THEME BY NAME ***********************************************************************************