improve module/theme creation UI to support internal/external scenarios

This commit is contained in:
sbwalker
2025-11-14 13:35:21 -05:00
parent c9590247eb
commit 2acd5799d9
4 changed files with 28 additions and 8 deletions

View File

@ -127,11 +127,18 @@
if (string.IsNullOrEmpty(_description)) _description = _module;
if (IsValidXML(_description))
{
if (_type == "Internal")
{
AddModuleMessage(Localizer["Success.Module.Create.Internal"], MessageType.Success);
}
var template = _templates.FirstOrDefault(item => item.Name == _template);
var moduleDefinition = new ModuleDefinition { Owner = _owner, Name = _module, Description = _description, Template = _template, Version = _reference, ModuleDefinitionName = template.Namespace };
moduleDefinition = await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition);
GetLocation();
AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success);
if (_type == "External")
{
GetLocation();
AddModuleMessage(string.Format(Localizer["Success.Module.Create.External"], NavigateUrl("admin/system")), MessageType.Success);
}
}
else
{

View File

@ -89,8 +89,8 @@
AddModuleMessage(Localizer["Info.Theme.CreatorIntent"], MessageType.Info);
}
}
protected override async Task OnParametersSetAsync()
protected override async Task OnParametersSetAsync()
{
try
{
@ -109,11 +109,18 @@
{
if (IsValid(_owner) && IsValid(_theme) && _owner != _theme && _template != "-")
{
if (_type == "Internal")
{
AddModuleMessage(Localizer["Success.Theme.Create.Internal"], MessageType.Success);
}
var template = _templates.FirstOrDefault(item => item.Name == _template);
var theme = new Theme { Owner = _owner, Name = _theme, Template = _template, Version = _reference, ThemeName = template.Namespace };
theme = await ThemeService.CreateThemeAsync(theme);
GetLocation();
AddModuleMessage(string.Format(Localizer["Success.Theme.Create"], NavigateUrl("admin/system")), MessageType.Success);
if (_type == "External")
{
GetLocation();
AddModuleMessage(string.Format(Localizer["Success.Theme.Create.External"], NavigateUrl("admin/system")), MessageType.Success);
}
}
else
{

View File

@ -168,7 +168,10 @@
<data name="Location.Text" xml:space="preserve">
<value>Location: </value>
</data>
<data name="Success.Module.Create" xml:space="preserve">
<data name="Success.Module.Create.Internal" xml:space="preserve">
<value>The Source Code For Your Module Has Been Created In Your Solution And Must Be Compiled In Order To Make It Functional</value>
</data>
<data name="Success.Module.Create.External" xml:space="preserve">
<value>The Source Code For Your Module Has Been Created At The Location Specified Below And Must Be Compiled In Order To Make It Functional. Once It Has Been Compiled You Must &lt;a href={0}&gt;Restart&lt;/a&gt; Your Application To Activate The Module.</value>
</data>
</root>

View File

@ -141,7 +141,10 @@
<data name="Info.Theme.CreatorIntent" xml:space="preserve">
<value>Please Note That The Theme Creator Is Only Intended To Be Used In A Development Environment</value>
</data>
<data name="Success.Theme.Create" xml:space="preserve">
<data name="Success.Theme.Create.Internal" xml:space="preserve">
<value>The Source Code For Your Theme Has Been Created In Your Solution And Must Be Compiled In Order To Make It Functional</value>
</data>
<data name="Success.Theme.Create.External" xml:space="preserve">
<value>The Source Code For Your Theme Has Been Created At The Location Specified Below And Must Be Compiled In Order To Make It Functional. Once It Has Been Compiled You Must &lt;a href={0}&gt;Restart&lt;/a&gt; Your Application To Activate The Theme.</value>
</data>
<data name="Message.Required.ValidName" xml:space="preserve">