Merge remote-tracking branch 'oqtane/dev' into dev

This commit is contained in:
Leigh Pointer 2023-06-19 21:52:12 +02:00
commit 694c0af146
4 changed files with 25 additions and 16 deletions

View File

@ -2,8 +2,14 @@
@using Oqtane.Shared
@inject SiteState SiteState
@((MarkupString)_title)
@((MarkupString)_content)
@if (!string.IsNullOrEmpty(_title))
{
@((MarkupString)_title)
}
@if (!string.IsNullOrEmpty(_content))
{
@((MarkupString)_content)
}
@code {
private string _title = "";

View File

@ -318,31 +318,29 @@
{
try
{
page.Panes = new List<string>();
page.Resources = new List<Resource>();
// validate theme
if (string.IsNullOrEmpty(page.ThemeType))
{
page.ThemeType = site.DefaultThemeType;
}
page.Panes = new List<string>();
page.Resources = new List<Resource>();
// get theme resources
var theme = site.Themes.FirstOrDefault(item => item.Themes.Any(item => item.TypeName == page.ThemeType));
if (theme != null)
{
page.Resources = ManagePageResources(page.Resources, theme.Resources, ResourceLevel.Page, alias, "Themes", Utilities.GetTypeName(theme.ThemeName));
}
string panes = "";
Type themetype = Type.GetType(page.ThemeType);
if (themetype == null)
if (themetype == null || theme == null)
{
// fallback
// fallback to default Oqtane theme
page.ThemeType = Constants.DefaultTheme;
themetype = Type.GetType(Constants.DefaultTheme);
}
string panes = "";
if (themetype != null)
{
// get resources for theme (ITheme)
page.Resources = ManagePageResources(page.Resources, theme.Resources, ResourceLevel.Page, alias, "Themes", Utilities.GetTypeName(theme.ThemeName));
var themeobject = Activator.CreateInstance(themetype) as IThemeControl;
if (themeobject != null)
{
@ -350,9 +348,11 @@
{
panes = themeobject.Panes;
}
// get resources for theme control
page.Resources = ManagePageResources(page.Resources, themeobject.Resources, ResourceLevel.Page, alias, "Themes", themetype.Namespace);
}
}
if (!string.IsNullOrEmpty(panes))
{
page.Panes = panes.Replace(";", ",").Split(',', StringSplitOptions.RemoveEmptyEntries).ToList();

View File

@ -258,6 +258,7 @@ namespace Oqtane.Controllers
// remove module definition
_moduleDefinitions.DeleteModuleDefinition(id);
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.ModuleDefinition, moduledefinition.ModuleDefinitionId, SyncEventActions.Delete);
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, moduledefinition.SiteId, SyncEventActions.Refresh);
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Module Definition {ModuleDefinitionName} Deleted", moduledefinition.Name);
}
else

View File

@ -117,7 +117,9 @@ namespace Oqtane.Controllers
}
// remove theme
//_themes.DeleteTheme(theme.ThemeName);
_themes.DeleteTheme(theme.ThemeId);
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Theme, theme.ThemeId, SyncEventActions.Delete);
_syncManager.AddSyncEvent(_alias.TenantId, EntityNames.Site, theme.SiteId, SyncEventActions.Refresh);
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Removed For {ThemeName}", theme.ThemeName);
}
else