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:
		@ -102,21 +102,21 @@
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
 | 
			
		||||
                                <option value="-"><Inherit From Site></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>
 | 
			
		||||
@ -125,15 +125,15 @@
 | 
			
		||||
                            <td>
 | 
			
		||||
                                <select id="Layout" class="form-control" @bind="@_layouttype">
 | 
			
		||||
                                    <option value="-"><Inherit From Site></option>
 | 
			
		||||
                                    @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
 | 
			
		||||
                                    @foreach (var layout in _layouts)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        if (panelayout.Key == _layouttype)
 | 
			
		||||
                                        if (layout.TypeName == _layouttype)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            <option value="@panelayout.Key" selected>@panelayout.Value</option>
 | 
			
		||||
                                            <option value="@(layout.TypeName)" selected>@(layout.Name)</option>
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            <option value="@panelayout.Key">@panelayout.Value</option>
 | 
			
		||||
                                            <option value="@(layout.TypeName)">@(layout.Name)</option>
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
@ -147,9 +147,9 @@
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <select id="defaultContainer" class="form-control" @bind="@_containertype">
 | 
			
		||||
                                <option value="-"><Inherit From Site></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>
 | 
			
		||||
@ -202,10 +202,10 @@
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
 | 
			
		||||
 | 
			
		||||
@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 List<Page> _pageList;
 | 
			
		||||
    private string _name;
 | 
			
		||||
    private string _title;
 | 
			
		||||
@ -235,7 +235,7 @@
 | 
			
		||||
            _pageList = PageState.Pages;
 | 
			
		||||
            _children = PageState.Pages.Where(item => item.ParentId == null).ToList();
 | 
			
		||||
 | 
			
		||||
            _themes = ThemeService.GetThemeTypes(_themeList);
 | 
			
		||||
            _themes = ThemeService.GetThemeControls(_themeList);
 | 
			
		||||
            _permissions = string.Empty;
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
@ -287,13 +287,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 = "-";
 | 
			
		||||
@ -311,7 +311,7 @@
 | 
			
		||||
        Page page = null;
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)))
 | 
			
		||||
            if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && (_layouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)))
 | 
			
		||||
            {
 | 
			
		||||
                page = new Page();
 | 
			
		||||
                page.SiteId = PageState.Page.SiteId;
 | 
			
		||||
 | 
			
		||||
@ -113,21 +113,21 @@
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
 | 
			
		||||
                                <option value="-"><Inherit From Site></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>
 | 
			
		||||
@ -136,15 +136,15 @@
 | 
			
		||||
                            <td>
 | 
			
		||||
                                <select id="Layout" class="form-control" @bind="@_layouttype">
 | 
			
		||||
                                    <option value="-"><Inherit From Site></option>
 | 
			
		||||
                                    @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
 | 
			
		||||
                                    @foreach (var layout in _layouts)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        if (panelayout.Key == _layouttype)
 | 
			
		||||
                                        if (layout.TypeName == _layouttype)
 | 
			
		||||
                                        {
 | 
			
		||||
                                            <option value="@panelayout.Key" selected>@panelayout.Value</option>
 | 
			
		||||
                                            <option value="@(layout.TypeName)" selected>@(layout.Name)</option>
 | 
			
		||||
                                        }
 | 
			
		||||
                                        else
 | 
			
		||||
                                        {
 | 
			
		||||
                                            <option value="@panelayout.Key">@panelayout.Value</option>
 | 
			
		||||
                                            <option value="@(layout.TypeName)">@(layout.Name)</option>
 | 
			
		||||
                                        }
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
@ -158,9 +158,9 @@
 | 
			
		||||
                        <td>
 | 
			
		||||
                            <select id="defaultContainer" class="form-control" @bind="@_containertype">
 | 
			
		||||
                                <option value="-"><Inherit From Site></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>
 | 
			
		||||
@ -215,10 +215,10 @@
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
 | 
			
		||||
 | 
			
		||||
@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 List<Page> _pageList;
 | 
			
		||||
    private int _pageId;
 | 
			
		||||
    private string _name;
 | 
			
		||||
@ -255,11 +255,11 @@
 | 
			
		||||
    {
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            _themeList = await ThemeService.GetThemesAsync();
 | 
			
		||||
            _pageList = PageState.Pages;
 | 
			
		||||
            _children = PageState.Pages.Where(item => item.ParentId == null).ToList();
 | 
			
		||||
 | 
			
		||||
            _themes = ThemeService.GetThemeTypes(_themeList);
 | 
			
		||||
            _themeList = await ThemeService.GetThemesAsync();
 | 
			
		||||
            _themes = ThemeService.GetThemeControls(_themeList);
 | 
			
		||||
 | 
			
		||||
            _pageId = Int32.Parse(PageState.QueryString["id"]);
 | 
			
		||||
            var page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId);
 | 
			
		||||
@ -293,13 +293,13 @@
 | 
			
		||||
                {
 | 
			
		||||
                    _themetype = "-";
 | 
			
		||||
                }
 | 
			
		||||
                _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, page.ThemeType);
 | 
			
		||||
                _layouts = ThemeService.GetLayoutControls(_themeList, page.ThemeType);
 | 
			
		||||
                _layouttype = page.LayoutType;
 | 
			
		||||
                if (_layouttype == PageState.Site.DefaultLayoutType)
 | 
			
		||||
                {
 | 
			
		||||
                    _layouttype = "-";
 | 
			
		||||
                }
 | 
			
		||||
                _containers = ThemeService.GetContainerTypes(_themeList, page.ThemeType);
 | 
			
		||||
                _containers = ThemeService.GetContainerControls(_themeList, page.ThemeType);
 | 
			
		||||
                _containertype = page.DefaultContainerType;
 | 
			
		||||
                if (string.IsNullOrEmpty(_containertype))
 | 
			
		||||
                {
 | 
			
		||||
@ -372,13 +372,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 = "-";
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user