Added support for friendly names and thumbnails in theme, layout, and container components. Added fallback support during loading for themes, layout, and containers.

This commit is contained in:
Shaun Walker
2020-06-01 14:58:46 -04:00
parent f45cb8b069
commit 1b7ca45d4a
26 changed files with 222 additions and 200 deletions

View File

@ -57,21 +57,21 @@
<td>
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="-">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes)
@foreach (var theme in _themes)
{
if (item.Key == _themetype)
if (theme.TypeName == _themetype)
{
<option value="@item.Key" selected>@item.Value</option>
<option value="@theme.TypeName" selected>@theme.Name</option>
}
else
{
<option value="@item.Key">@item.Value</option>
<option value="@theme.TypeName">@theme.Name</option>
}
}
</select>
</td>
</tr>
@if (_panelayouts.Count > 0)
@if (_layouts.Count > 0)
{
<tr>
<td>
@ -80,9 +80,9 @@
<td>
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
<option value="-">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
@foreach (var layout in _layouts)
{
<option value="@panelayout.Key">@panelayout.Value</option>
<option value="@(layout.TypeName)">@(layout.Name)</option>
}
</select>
</td>
@ -95,9 +95,9 @@
<td>
<select id="defaultContainer" class="form-control" @bind="@_containertype">
<option value="-">&lt;Select Container&gt;</option>
@foreach (KeyValuePair<string, string> container in _containers)
@foreach (var container in _containers)
{
<option value="@container.Key">@container.Value</option>
<option value="@container.TypeName">@container.Name</option>
}
</select>
</td>
@ -211,10 +211,10 @@
}
@code {
private Dictionary<string, string> _themes = new Dictionary<string, string>();
private Dictionary<string, string> _panelayouts = new Dictionary<string, string>();
private Dictionary<string, string> _containers = new Dictionary<string, string>();
private List<Theme> _themeList;
private List<ThemeControl> _themes = new List<ThemeControl>();
private List<ThemeControl> _layouts = new List<ThemeControl>();
private List<ThemeControl> _containers = new List<ThemeControl>();
private string _name = string.Empty;
private List<Tenant> _tenantList;
private string _tenant = string.Empty;
@ -274,10 +274,11 @@
_faviconfileid = site.FaviconFileId.Value;
}
_themes = ThemeService.GetThemeControls(_themeList);
_themetype = site.DefaultThemeType;
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
_layouttype = site.DefaultLayoutType;
_containers = ThemeService.GetContainerTypes(_themeList, _themetype);
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
_containertype = site.DefaultContainerType;
_allowregistration = site.AllowRegistration.ToString();
@ -318,9 +319,6 @@
_deletedon = site.DeletedOn;
_isdeleted = site.IsDeleted.ToString();
}
_themes = ThemeService.GetThemeTypes(_themeList);
_containers = ThemeService.GetContainerTypes(_themeList, _themetype);
}
catch (Exception ex)
{
@ -336,13 +334,13 @@
_themetype = (string)e.Value;
if (_themetype != "-")
{
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
_containers = ThemeService.GetContainerTypes(_themeList, _themetype);
_layouts = ThemeService.GetLayoutControls(_themeList, _themetype);
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
}
else
{
_panelayouts = new Dictionary<string, string>();
_containers = new Dictionary<string, string>();
_layouts = new List<ThemeControl>();
_containers = new List<ThemeControl>();
}
_layouttype = "-";
_containertype = "-";
@ -359,7 +357,7 @@
{
try
{
if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_panelayouts.Count == 0 || _layouttype != "-") && _containertype != "-")
if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_layouts.Count == 0 || _layouttype != "-") && _containertype != "-")
{
var unique = true;
foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))