restrict container selection to the current theme, hide layout selection if theme does not support layouts, make behavior consistent for all theme/layout/container selection

This commit is contained in:
Shaun Walker
2020-05-31 22:53:11 -04:00
parent be4813d9c0
commit 7d21cfefc1
9 changed files with 160 additions and 125 deletions

View File

@ -9,7 +9,7 @@ namespace Oqtane.Services
Task<List<Theme>> GetThemesAsync();
Dictionary<string, string> GetThemeTypes(List<Theme> themes);
Dictionary<string, string> GetPaneLayoutTypes(List<Theme> themes, string themeName);
Dictionary<string, string> GetContainerTypes(List<Theme> themes);
Dictionary<string, string> GetContainerTypes(List<Theme> themes, string themeName);
Task InstallThemesAsync();
Task DeleteThemeAsync(string themeName);
}

View File

@ -43,8 +43,8 @@ namespace Oqtane.Services
{
var selectablePaneLayouts = new Dictionary<string, string>();
foreach (Theme theme in themes)
{
if (themeName.StartsWith(theme.ThemeName))
{
if (Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(theme.ThemeName)))
{
foreach (string panelayout in theme.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
@ -55,14 +55,17 @@ namespace Oqtane.Services
return selectablePaneLayouts;
}
public Dictionary<string, string> GetContainerTypes(List<Theme> themes)
public Dictionary<string, string> GetContainerTypes(List<Theme> themes, string themeName)
{
var selectableContainers = new Dictionary<string, string>();
foreach (Theme theme in themes)
{
foreach (string container in theme.ContainerControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
if (Utilities.GetTypeName(themeName).StartsWith(Utilities.GetTypeName(theme.ThemeName)))
{
selectableContainers.Add(container, theme.Name + " - " + @Utilities.GetTypeNameLastSegment(container, 0));
foreach (string container in theme.ContainerControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
selectableContainers.Add(container, theme.Name + " - " + @Utilities.GetTypeNameLastSegment(container, 0));
}
}
}
return selectableContainers;