extensibility enhancements for site templates
This commit is contained in:
		| @ -5,6 +5,7 @@ | ||||
| @inject IAliasService AliasService | ||||
| @inject ISiteService SiteService | ||||
| @inject IThemeService  ThemeService | ||||
| @inject ISiteTemplateService SiteTemplateService  | ||||
| @inject IUserService UserService | ||||
|  | ||||
| @if (_tenants == null) | ||||
| @ -16,7 +17,7 @@ else | ||||
| <table class="table table-borderless"> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <label  class="control-label">Tenant: </label> | ||||
|             <label class="control-label">Tenant: </label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <select class="form-control" @onchange="(e => TenantChanged(e))"> | ||||
| @ -30,7 +31,7 @@ else | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <label  class="control-label">Name: </label> | ||||
|             <label class="control-label">Name: </label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <input class="form-control" @bind="@_name" /> | ||||
| @ -38,7 +39,7 @@ else | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <label  class="control-label">Aliases: </label> | ||||
|             <label class="control-label">Aliases: </label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <textarea class="form-control" @bind="@_urls" rows="3"></textarea> | ||||
| @ -46,7 +47,7 @@ else | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <label  class="control-label">Default Theme: </label> | ||||
|             <label class="control-label">Default Theme: </label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <select class="form-control" @onchange="(e => ThemeChanged(e))"> | ||||
| @ -60,7 +61,7 @@ else | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <label  class="control-label">Default Layout: </label> | ||||
|             <label class="control-label">Default Layout: </label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <select class="form-control" @bind="@_layouttype"> | ||||
| @ -74,23 +75,37 @@ else | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <label  class="control-label">Default Container: </label> | ||||
|             <label class="control-label">Default Container: </label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <select class="form-control" @bind="@_containertype"> | ||||
|                 <option value=""><Select Container></option> | ||||
|                 @foreach (KeyValuePair<string, string>container in _containers) | ||||
|                 @foreach (KeyValuePair<string, string> container in _containers) | ||||
|                 { | ||||
|                     <option value="@container.Key">@container.Value</option> | ||||
|                 } | ||||
|             </select> | ||||
|         </td> | ||||
|     </tr> | ||||
|     <tr> | ||||
|         <td> | ||||
|             <label class="control-label">Site Template: </label> | ||||
|         </td> | ||||
|         <td> | ||||
|             <select class="form-control" @bind="@_sitetemplatetype"> | ||||
|                 <option value=""><Select Site Template></option> | ||||
|                 @foreach (SiteTemplate siteTemplate in _siteTemplates) | ||||
|                 { | ||||
|                     <option value="@siteTemplate.TypeName">@siteTemplate.Name</option> | ||||
|                 } | ||||
|             </select> | ||||
|         </td> | ||||
|     </tr> | ||||
|     @if (!_isinitialized) | ||||
|     { | ||||
|         <tr> | ||||
|             <td> | ||||
|                 <label  class="control-label">Host Username:</label> | ||||
|                 <label class="control-label">Host Username:</label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <input class="form-control" @bind="@_username" readonly /> | ||||
| @ -98,7 +113,7 @@ else | ||||
|         </tr> | ||||
|         <tr> | ||||
|             <td> | ||||
|                 <label  class="control-label">Host Password:</label> | ||||
|                 <label class="control-label">Host Password:</label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <input type="password" class="form-control" @bind="@_password" /> | ||||
| @ -116,6 +131,7 @@ else | ||||
|     Dictionary<string, string> _themes = new Dictionary<string, string>(); | ||||
|     Dictionary<string, string> _panelayouts = new Dictionary<string, string>(); | ||||
|     Dictionary<string, string> _containers = new Dictionary<string, string>(); | ||||
|     List<SiteTemplate> _siteTemplates; | ||||
|  | ||||
|     List<Theme> _themeList; | ||||
|     List<Tenant> _tenants; | ||||
| @ -125,6 +141,7 @@ else | ||||
|     string _themetype = ""; | ||||
|     string _layouttype = ""; | ||||
|     string _containertype = ""; | ||||
|     string _sitetemplatetype = ""; | ||||
|     bool _isinitialized = true; | ||||
|     string _username = ""; | ||||
|     string _password = ""; | ||||
| @ -136,6 +153,7 @@ else | ||||
|         _urls = PageState.Alias.Name; | ||||
|         _themes = ThemeService.GetThemeTypes(_themeList); | ||||
|         _containers = ThemeService.GetContainerTypes(_themeList); | ||||
|         _siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync(); | ||||
|         _username = Constants.HostUser; | ||||
|     } | ||||
|  | ||||
| @ -185,7 +203,7 @@ else | ||||
|  | ||||
|     private async Task SaveSite() | ||||
|     { | ||||
|         if (_tenantid != "-1" && _name != "" && _urls != "" && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype)) | ||||
|         if (_tenantid != "-1" && _name != "" && _urls != "" && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype) && !string.IsNullOrEmpty(_sitetemplatetype)) | ||||
|         { | ||||
|             bool unique = true; | ||||
|             List<Alias> aliases = await AliasService.GetAliasesAsync(); | ||||
| @ -233,6 +251,7 @@ else | ||||
|                     site.DefaultThemeType = _themetype; | ||||
|                     site.DefaultLayoutType = (_layouttype == null ? "" : _layouttype); | ||||
|                     site.DefaultContainerType = _containertype; | ||||
|                     site.SiteTemplateType = _sitetemplatetype; | ||||
|                     site = await SiteService.AddSiteAsync(site, aliases[0]); | ||||
|  | ||||
|                     foreach (Alias alias in aliases) | ||||
| @ -276,7 +295,7 @@ else | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, And Default Theme/Container", MessageType.Warning); | ||||
|             AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, Default Theme/Container, And Site Template", MessageType.Warning); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker