fix #2387 - improve container selection in Edit Page

This commit is contained in:
sbwalker 2023-06-21 09:20:05 -04:00
parent 05b5d9da9b
commit c3bccbade8

View File

@ -367,11 +367,11 @@
// appearance // appearance
_title = _page.Title; _title = _page.Title;
_themetype = _page.ThemeType; if (string.IsNullOrEmpty(_page.ThemeType))
if (string.IsNullOrEmpty(_themetype))
{ {
_themetype = PageState.Site.DefaultThemeType; _page.ThemeType = PageState.Site.DefaultThemeType;
} }
_themetype = _page.ThemeType;
_containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype); _containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype);
_containertype = _page.DefaultContainerType; _containertype = _page.DefaultContainerType;
if (string.IsNullOrEmpty(_containertype)) if (string.IsNullOrEmpty(_containertype))
@ -480,11 +480,16 @@
try try
{ {
_themetype = (string)e.Value; _themetype = (string)e.Value;
var oldTheme = PageState.Site.Themes.FirstOrDefault(item => item.Themes.Any(themecontrol => themecontrol.TypeName.Equals(_page.ThemeType)));
var newTheme = PageState.Site.Themes.FirstOrDefault(item => item.Themes.Any(themecontrol => themecontrol.TypeName.Equals(_themetype)));
if (oldTheme.ThemeName != newTheme.ThemeName)
{
_containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype); _containers = ThemeService.GetContainerControls(PageState.Site.Themes, _themetype);
_containertype = "-"; _containertype = _containers.First().TypeName;
ThemeSettings(); ThemeSettings();
StateHasChanged(); StateHasChanged();
} }
}
catch (Exception ex) catch (Exception ex)
{ {
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message); await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);