fix UX in module/theme creators

This commit is contained in:
Shaun Walker 2021-11-10 15:56:51 -05:00
parent cc5396801b
commit 4ed4f8d942
6 changed files with 79 additions and 65 deletions

View File

@ -91,14 +91,9 @@ else
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
protected override async Task OnParametersSetAsync() protected override void OnInitialized()
{
try
{ {
_moduledefinitionname = SettingService.GetSetting(ModuleState.Settings, "ModuleDefinitionName", ""); _moduledefinitionname = SettingService.GetSetting(ModuleState.Settings, "ModuleDefinitionName", "");
_templates = await ModuleDefinitionService.GetModuleDefinitionTemplatesAsync();
_versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray();
if (string.IsNullOrEmpty(_moduledefinitionname)) if (string.IsNullOrEmpty(_moduledefinitionname))
{ {
AddModuleMessage(Localizer["Info.Module.Creator"], MessageType.Info); AddModuleMessage(Localizer["Info.Module.Creator"], MessageType.Info);
@ -108,6 +103,14 @@ else
AddModuleMessage(Localizer["Info.Module.Activate"], MessageType.Info); AddModuleMessage(Localizer["Info.Module.Activate"], MessageType.Info);
} }
} }
protected override async Task OnParametersSetAsync()
{
try
{
_templates = await ModuleDefinitionService.GetModuleDefinitionTemplatesAsync();
_versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray();
}
catch (Exception ex) catch (Exception ex)
{ {
await logger.LogError(ex, "Error Loading Module Creator"); await logger.LogError(ex, "Error Loading Module Creator");
@ -130,7 +133,6 @@ else
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId); await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
GetLocation(); GetLocation();
AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success); AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success);
} }
catch (Exception ex) catch (Exception ex)

View File

@ -87,13 +87,17 @@
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
protected override void OnInitialized()
{
AddModuleMessage(Localizer["Info.Module.Development"], MessageType.Info);
}
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
try try
{ {
_templates = await ModuleDefinitionService.GetModuleDefinitionTemplatesAsync(); _templates = await ModuleDefinitionService.GetModuleDefinitionTemplatesAsync();
_versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray(); _versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray();
AddModuleMessage(Localizer["Info.Module.Development"], MessageType.Info);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -11,7 +11,7 @@
@if (_templates != null) @if (_templates != null)
{ {
<div class="container"> <div class="container">
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this theme. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label> <Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this theme. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
@ -51,7 +51,8 @@
</select> </select>
</div> </div>
</div> </div>
@if (!string.IsNullOrEmpty(_location)) { @if (!string.IsNullOrEmpty(_location))
{
<div class="row mb-1 align-items-center"> <div class="row mb-1 align-items-center">
<Label Class="col-sm-3" For="location" HelpText="Location where the theme will be created" ResourceKey="Location">Location: </Label> <Label Class="col-sm-3" For="location" HelpText="Location where the theme will be created" ResourceKey="Location">Location: </Label>
<div class="col-sm-9"> <div class="col-sm-9">
@ -59,7 +60,7 @@
</div> </div>
</div> </div>
} }
</div> </div>
<br /> <br />
<button type="button" class="btn btn-success" @onclick="CreateTheme">@Localizer["Theme.Create"]</button> <button type="button" class="btn btn-success" @onclick="CreateTheme">@Localizer["Theme.Create"]</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
@ -77,13 +78,17 @@
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host; public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
protected override void OnInitialized()
{
AddModuleMessage(Localizer["Info.Theme.CreatorIntent"], MessageType.Info);
}
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {
try try
{ {
_templates = await ThemeService.GetThemeTemplatesAsync(); _templates = await ThemeService.GetThemeTemplatesAsync();
_versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray(); _versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray();
AddModuleMessage(Localizer["Info.Theme.CreatorIntent"], MessageType.Info);
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -38,6 +38,7 @@ namespace Oqtane.SiteTemplates
{ {
Name = "Home", Name = "Home",
Parent = "", Parent = "",
Order = 1,
Path = "", Path = "",
Icon = "oi oi-home", Icon = "oi oi-home",
IsNavigation = true, IsNavigation = true,
@ -84,6 +85,7 @@ namespace Oqtane.SiteTemplates
{ {
Name = "Private", Name = "Private",
Parent = "", Parent = "",
Order = 3,
Path = "private", Path = "private",
Icon = "oi oi-lock-locked", Icon = "oi oi-lock-locked",
IsNavigation = true, IsNavigation = true,
@ -108,6 +110,7 @@ namespace Oqtane.SiteTemplates
{ {
Name = "My Page", Name = "My Page",
Parent = "", Parent = "",
Order = 5,
Path = "mypage", Path = "mypage",
Icon = "oi oi-target", Icon = "oi oi-target",
IsNavigation = true, IsNavigation = true,

View File

@ -1,5 +1,5 @@
{ {
"Title": "Default Module Template", "Title": "Default Module Template",
"Type": "External", "Type": "External",
"Version": "2.2.0" "Version": "3.0.0"
} }

View File

@ -1,5 +1,5 @@
{ {
"Title": "Default Theme Template", "Title": "Default Theme Template",
"Type": "External", "Type": "External",
"Version": "2.2.0" "Version": "3.0.0"
} }