fix #2912 - move JavaScript handling from ThemeBuilder to component OnAfterRenderAsync

This commit is contained in:
sbwalker
2023-06-21 08:31:51 -04:00
parent c8a679ecce
commit 8067b2e634
5 changed files with 71 additions and 31 deletions

View File

@ -333,10 +333,11 @@
// fallback to default Oqtane theme
page.ThemeType = Constants.DefaultTheme;
themetype = Type.GetType(Constants.DefaultTheme);
theme = site.Themes.FirstOrDefault(item => item.Themes.Any(item => item.TypeName == page.ThemeType));
}
string panes = "";
if (themetype != null)
if (themetype != null && theme != null)
{
// get resources for theme (ITheme)
page.Resources = ManagePageResources(page.Resources, theme.Resources, ResourceLevel.Page, alias, "Themes", Utilities.GetTypeName(theme.ThemeName));
@ -522,10 +523,11 @@
}
// ensure resource does not exist already
if (!pageresources.Any(item => item.Url.ToLower() == resource.Url.ToLower()))
if (!pageresources.Exists(item => item.Url.ToLower() == resource.Url.ToLower()))
{
resource.Level = level;
pageresources.Add(resource);
resource.Namespace = name;
pageresources.Add(resource);
}
}
}