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:
		| @ -38,7 +38,7 @@ else | ||||
|         </td> | ||||
|         <td> | ||||
|             <select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))"> | ||||
|                 <option value=""><Select Theme></option> | ||||
|                 <option value="-"><Select Theme></option> | ||||
|                 @foreach (KeyValuePair<string, string> item in _themes) | ||||
|                 { | ||||
|                     <option value="@item.Key">@item.Value</option> | ||||
| @ -46,27 +46,30 @@ else | ||||
|             </select> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <select id="defaultLayout" class="form-control" @bind="@_layouttype"> | ||||
|                 <option value=""><Select Layout></option> | ||||
|                 @foreach (KeyValuePair<string, string> panelayout in _panelayouts) | ||||
|                 { | ||||
|                     <option value="@panelayout.Key">@panelayout.Value</option> | ||||
|                 } | ||||
|             </select> | ||||
|         </td> | ||||
|     </tr> | ||||
|     @if (_panelayouts.Count > 0) | ||||
|     { | ||||
|         <tr> | ||||
|             <td> | ||||
|                 <Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <select id="defaultLayout" class="form-control" @bind="@_layouttype"> | ||||
|                     <option value="-"><Select Layout></option> | ||||
|                     @foreach (KeyValuePair<string, string> panelayout in _panelayouts) | ||||
|                     { | ||||
|                         <option value="@panelayout.Key">@panelayout.Value</option> | ||||
|                     } | ||||
|                 </select> | ||||
|             </td> | ||||
|         </tr> | ||||
|     } | ||||
|     <tr> | ||||
|         <td> | ||||
|             <Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <select id="defaultContainer" class="form-control" @bind="@_containertype"> | ||||
|                 <option value=""><Select Container></option> | ||||
|                 <option value="-"><Select Container></option> | ||||
|                 @foreach (KeyValuePair<string, string> container in _containers) | ||||
|                 { | ||||
|                     <option value="@container.Key">@container.Value</option> | ||||
| @ -80,7 +83,7 @@ else | ||||
|         </td> | ||||
|         <td> | ||||
|             <select id="siteTemplate" class="form-control" @bind="@_sitetemplatetype"> | ||||
|                 <option value=""><Select Site Template></option> | ||||
|                 <option value="-"><Select Site Template></option> | ||||
|                 @foreach (SiteTemplate siteTemplate in _siteTemplates) | ||||
|                 { | ||||
|                     <option value="@siteTemplate.TypeName">@siteTemplate.Name</option> | ||||
| @ -218,10 +221,10 @@ else | ||||
|  | ||||
|     private string _name = string.Empty; | ||||
|     private string _urls = string.Empty; | ||||
|     private string _themetype = string.Empty; | ||||
|     private string _layouttype = string.Empty; | ||||
|     private string _containertype = string.Empty; | ||||
|     private string _sitetemplatetype = string.Empty; | ||||
|     private string _themetype = "-"; | ||||
|     private string _layouttype = "-"; | ||||
|     private string _containertype = "-"; | ||||
|     private string _sitetemplatetype = "-"; | ||||
|  | ||||
|     public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host; | ||||
|  | ||||
| @ -231,7 +234,6 @@ else | ||||
|         _tenants = await TenantService.GetTenantsAsync(); | ||||
|         _urls = PageState.Alias.Name; | ||||
|         _themes = ThemeService.GetThemeTypes(_themeList); | ||||
|         _containers = ThemeService.GetContainerTypes(_themeList); | ||||
|         _siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync(); | ||||
|     } | ||||
|  | ||||
| @ -266,12 +268,15 @@ else | ||||
|             if (_themetype != string.Empty) | ||||
|             { | ||||
|                 _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); | ||||
|                 _containers = ThemeService.GetContainerTypes(_themeList, _themetype); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 _panelayouts = new Dictionary<string, string>(); | ||||
|                 _containers = new Dictionary<string, string>(); | ||||
|             } | ||||
|  | ||||
|             _layouttype = "-"; | ||||
|             _containertype = "-"; | ||||
|             StateHasChanged(); | ||||
|         } | ||||
|         catch (Exception ex) | ||||
| @ -283,7 +288,7 @@ else | ||||
|  | ||||
|     private async Task SaveSite() | ||||
|     { | ||||
|         if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype) && !string.IsNullOrEmpty(_sitetemplatetype)) | ||||
|         if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && _themetype != "-" && (_panelayouts.Count == 0 || _layouttype != "-") && _containertype != "-" && _sitetemplatetype != "-") | ||||
|         { | ||||
|             var duplicates = new List<string>(); | ||||
|             var aliases = await AliasService.GetAliasesAsync(); | ||||
|  | ||||
| @ -39,7 +39,7 @@ | ||||
|             </td> | ||||
|             <td> | ||||
|                 <select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))"> | ||||
|                     <option value=""><Select Theme></option> | ||||
|                     <option value="-"><Select Theme></option> | ||||
|                     @foreach (KeyValuePair<string, string> item in _themes) | ||||
|                     { | ||||
|                         if (item.Key == _themetype) | ||||
| @ -54,27 +54,30 @@ | ||||
|                 </select> | ||||
|             </td> | ||||
|         </tr> | ||||
|         <tr> | ||||
|             <td> | ||||
|                 <Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <select id="defaultLayout" class="form-control" @bind="@_layouttype"> | ||||
|                     <option value=""><Select Layout></option> | ||||
|                     @foreach (KeyValuePair<string, string> panelayout in _panelayouts) | ||||
|                     { | ||||
|                         <option value="@panelayout.Key">@panelayout.Value</option> | ||||
|                     } | ||||
|                 </select> | ||||
|             </td> | ||||
|         </tr> | ||||
|         @if (_panelayouts.Count > 0) | ||||
|         { | ||||
|             <tr> | ||||
|                 <td> | ||||
|                     <Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label> | ||||
|                 </td> | ||||
|                 <td> | ||||
|                     <select id="defaultLayout" class="form-control" @bind="@_layouttype"> | ||||
|                         <option value="-"><Select Layout></option> | ||||
|                         @foreach (KeyValuePair<string, string> panelayout in _panelayouts) | ||||
|                         { | ||||
|                             <option value="@panelayout.Key">@panelayout.Value</option> | ||||
|                         } | ||||
|                     </select> | ||||
|                 </td> | ||||
|             </tr> | ||||
|         } | ||||
|         <tr> | ||||
|             <td> | ||||
|                 <Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <select id="defaultIdea" class="form-control" @bind="@_containertype"> | ||||
|                     <option value=""><Select Container></option> | ||||
|                     <option value="-"><Select Container></option> | ||||
|                     @foreach (KeyValuePair<string, string> container in _containers) | ||||
|                     { | ||||
|                         <option value="@container.Key">@container.Value</option> | ||||
| @ -103,9 +106,9 @@ | ||||
| } | ||||
|  | ||||
| @code { | ||||
|     private Dictionary<string, string> _themes; | ||||
|     private Dictionary<string, string> _panelayouts; | ||||
|     private Dictionary<string, string> _containers; | ||||
|     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 Alias _alias; | ||||
|     private List<Theme> _themeList; | ||||
|     private string _name = string.Empty; | ||||
| @ -147,9 +150,11 @@ | ||||
|                     _urls += alias.Name + "\n"; | ||||
|                 } | ||||
|  | ||||
|                 _themes = ThemeService.GetThemeTypes(_themeList); | ||||
|                 _themetype = site.DefaultThemeType; | ||||
|                 _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); | ||||
|                 _layouttype = site.DefaultLayoutType; | ||||
|                 _containers = ThemeService.GetContainerTypes(_themeList, _themetype); | ||||
|                 _containertype = site.DefaultContainerType; | ||||
|                 _createdby = site.CreatedBy; | ||||
|                 _createdon = site.CreatedOn; | ||||
| @ -159,9 +164,6 @@ | ||||
|                 _deletedon = site.DeletedOn; | ||||
|                 _isdeleted = site.IsDeleted.ToString(); | ||||
|             } | ||||
|  | ||||
|             _themes = ThemeService.GetThemeTypes(_themeList); | ||||
|             _containers = ThemeService.GetContainerTypes(_themeList); | ||||
|         } | ||||
|         catch (Exception ex) | ||||
|         { | ||||
| @ -178,12 +180,15 @@ | ||||
|             if (_themetype != string.Empty) | ||||
|             { | ||||
|                 _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); | ||||
|                 _containers = ThemeService.GetContainerTypes(_themeList, _themetype); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 _panelayouts = new Dictionary<string, string>(); | ||||
|                 _containers = new Dictionary<string, string>(); | ||||
|             } | ||||
|  | ||||
|             _layouttype = "-"; | ||||
|             _containertype = "-"; | ||||
|             StateHasChanged(); | ||||
|         } | ||||
|         catch (Exception ex) | ||||
| @ -197,7 +202,7 @@ | ||||
|     { | ||||
|         try | ||||
|         { | ||||
|             if (_name != string.Empty && _urls != string.Empty && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype)) | ||||
|             if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && (_panelayouts.Count == 0 || _layouttype != "-") && _containertype != "-") | ||||
|             { | ||||
|                 var unique = true; | ||||
|                 foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker