Browse Source

Add support for nullable enums in various components and tag helpers

pull/24257/head
maliming 3 months ago
parent
commit
d1bfaa2263
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs
  2. 16
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs
  3. 10
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/ObjectExtending/MvcUiObjectExtensionPropertyInfoExtensions.cs
  4. 5
      framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs
  5. 2
      framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor
  6. 40
      framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/SelectExtensionProperty.razor.cs
  7. 2
      modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor
  8. 5
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml
  9. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml
  10. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml
  11. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml
  12. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml
  13. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Menus/MenuItems/CreateModal.cshtml
  14. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Menus/MenuItems/UpdateModal.cshtml
  15. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml
  16. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml
  17. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml
  18. 5
      modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml
  19. 5
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml
  20. 5
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml
  21. 5
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml
  22. 5
      modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml
  23. 5
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml
  24. 5
      modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelper.cs

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
@ -14,6 +15,8 @@ public class AbpSelectTagHelper : AbpTagHelper<AbpSelectTagHelper, AbpSelectTagH
public bool SuppressLabel { get; set; }
public Type? EnumType { get; set; }
public IEnumerable<SelectListItem>? AspItems { get; set; }
public AbpFormControlSize Size { get; set; } = AbpFormControlSize.Default;

16
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs

@ -12,6 +12,7 @@ using Microsoft.Extensions.Localization;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Extensions;
using Volo.Abp.Localization;
using Volo.Abp.Reflection;
namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;
@ -169,7 +170,9 @@ public class AbpSelectTagHelperService : AbpTagHelperService<AbpSelectTagHelper>
private bool IsEnum()
{
var value = TagHelper.AspFor.Model;
return (value != null && value.GetType().IsEnum) || TagHelper.AspFor.ModelExplorer.Metadata.IsEnum;
return (value != null && value.GetType().IsEnum) ||
TagHelper.AspFor.ModelExplorer.Metadata.IsEnum ||
(TagHelper.EnumType != null && TypeHelper.IsNullableEnum(TagHelper.EnumType));
}
protected virtual async Task<string> GetLabelAsHtmlAsync(TagHelperContext context, TagHelperOutput output, TagHelperOutput selectTag)
@ -258,19 +261,20 @@ public class AbpSelectTagHelperService : AbpTagHelperService<AbpSelectTagHelper>
protected virtual List<SelectListItem> GetSelectItemsFromEnum(TagHelperContext context, TagHelperOutput output, ModelExplorer explorer)
{
var enumType = TagHelper.EnumType ?? explorer.ModelType;
var selectItems = new List<SelectListItem>();
var isNullableType = Nullable.GetUnderlyingType(explorer.ModelType) != null;
var enumType = explorer.ModelType;
var isNullableType = Nullable.GetUnderlyingType(enumType!) != null;
if (isNullableType)
{
enumType = Nullable.GetUnderlyingType(explorer.ModelType)!;
enumType = Nullable.GetUnderlyingType(enumType!)!;
selectItems.Add(new SelectListItem());
}
var containerLocalizer = _tagHelperLocalizer.GetLocalizerOrNull(explorer.Container.ModelType.Assembly);
foreach (var enumValue in enumType.GetEnumValuesAsUnderlyingType())
foreach (var enumValue in enumType!.GetEnumValuesAsUnderlyingType())
{
var localizedMemberName = _abpEnumLocalizer.GetString(enumType, enumValue,
new[]
@ -306,7 +310,7 @@ public class AbpSelectTagHelperService : AbpTagHelperService<AbpSelectTagHelper>
};
var innerOutput = await labelTagHelper.ProcessAndGetOutputAsync(new TagHelperAttributeList { { "class", "form-label" } }, context, "label", TagMode.StartTagAndEndTag);
innerOutput.Content.AppendHtml(GetRequiredSymbol(context, output));
return innerOutput.Render(_encoder);

10
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/ObjectExtending/MvcUiObjectExtensionPropertyInfoExtensions.cs

@ -88,6 +88,16 @@ public static class MvcUiObjectExtensionPropertyInfoExtensions
?? "text"; //default
}
public static bool IsEnum(this ObjectExtensionPropertyInfo propertyInfo)
{
return propertyInfo.Type.IsEnum || TypeHelper.IsNullableEnum(propertyInfo.Type);
}
public static bool IsNullableEnum(this ObjectExtensionPropertyInfo propertyInfo)
{
return TypeHelper.IsNullableEnum(propertyInfo.Type);
}
private static string? GetInputTypeFromAttributeOrNull(Attribute attribute)
{
if (attribute is EmailAddressAttribute)

5
framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs

@ -218,6 +218,11 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions
?? typeof(TextExtensionProperty<,>); //default
}
public static bool IsEnum(this ObjectExtensionPropertyInfo propertyInfo)
{
return propertyInfo.Type.IsEnum || TypeHelper.IsNullableEnum(propertyInfo.Type);
}
private static Type? GetInputTypeFromAttributeOrNull(Attribute attribute)
{
var hasTextEditSupport = TextEditSupportedAttributeTypes.Any(t => t == attribute.GetType());

2
framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor

@ -9,7 +9,7 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
<SelectExtensionProperty PropertyInfo="@propertyInfo" Entity="@Entity" TEntity="TEntityType" TResourceType="TResourceType" LH="@LH" />
}

40
framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/SelectExtensionProperty.razor.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.Localization;
using System;
using Microsoft.Extensions.Localization;
using System.Collections.Generic;
using Volo.Abp.Data;
@ -7,23 +8,35 @@ namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending;
public partial class SelectExtensionProperty<TEntity, TResourceType>
where TEntity : IHasExtraProperties
{
protected List<SelectItem<int>> SelectItems = new();
protected List<SelectItem<int?>> SelectItems = new();
public int SelectedValue {
get { return Entity.GetProperty<int>(PropertyInfo.Name); }
public int? SelectedValue {
get
{
return Entity.GetProperty<int?>(PropertyInfo.Name, Nullable.GetUnderlyingType(PropertyInfo.Type!) != null ? null : 0);
}
set { Entity.SetProperty(PropertyInfo.Name, value, false); }
}
protected virtual List<SelectItem<int>> GetSelectItemsFromEnum()
protected virtual List<SelectItem<int?>> GetSelectItemsFromEnum()
{
var selectItems = new List<SelectItem<int>>();
var selectItems = new List<SelectItem<int?>>();
var isNullableType = Nullable.GetUnderlyingType(PropertyInfo.Type!) != null;
var enumType = isNullableType
? Nullable.GetUnderlyingType(PropertyInfo.Type)!
: PropertyInfo.Type;
foreach (var enumValue in PropertyInfo.Type.GetEnumValues())
if (isNullableType)
{
selectItems.Add(new SelectItem<int>
selectItems.Add(new SelectItem<int?>());
}
foreach (var enumValue in enumType.GetEnumValues())
{
selectItems.Add(new SelectItem<int?>
{
Value = (int)enumValue,
Text = AbpEnumLocalizer.GetString(PropertyInfo.Type, enumValue, new []{ StringLocalizerFactory.CreateDefaultOrNull() })
Text = AbpEnumLocalizer.GetString(enumType, enumValue, new []{ StringLocalizerFactory.CreateDefaultOrNull() })
});
}
@ -37,7 +50,14 @@ public partial class SelectExtensionProperty<TEntity, TResourceType>
if (!Entity.HasProperty(PropertyInfo.Name))
{
SelectedValue = (int)PropertyInfo.Type.GetEnumValues().GetValue(0)!;
var isNullableType = Nullable.GetUnderlyingType(PropertyInfo.Type!) != null;
if (!isNullableType)
{
var enumType = isNullableType
? Nullable.GetUnderlyingType(PropertyInfo.Type)!
: PropertyInfo.Type;
SelectedValue = (int)enumType.GetEnumValues().GetValue(0)!;
}
}
}
}

2
modules/account/src/Volo.Abp.Account.Blazor/Pages/Account/AccountManage.razor

@ -78,7 +78,7 @@
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
<SelectExtensionProperty PropertyInfo="@propertyInfo" Entity="@PersonalInfoModel" TEntity="PersonalInfoModel" TResourceType="AccountResource" LH="@LH" />
}

5
modules/account/src/Volo.Abp.Account.Web/Pages/Account/Components/ProfileManagementGroup/PersonalInfo/Default.cshtml

@ -60,13 +60,14 @@
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
name="ExtraProperties.@propertyInfo.Name"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Create.cshtml

@ -91,13 +91,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/BlogPosts/Update.cshtml

@ -95,13 +95,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/CreateModal.cshtml

@ -32,13 +32,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Blogs/UpdateModal.cshtml

@ -33,13 +33,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Menus/MenuItems/CreateModal.cshtml

@ -76,13 +76,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Menus/MenuItems/UpdateModal.cshtml

@ -98,13 +98,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Create.cshtml

@ -90,13 +90,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Pages/Update.cshtml

@ -95,13 +95,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/CreateModal.cshtml

@ -32,13 +32,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Tags/EditModal.cshtml

@ -30,13 +30,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.ViewModel.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="ViewModel.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.ViewModel.GetProperty(propertyInfo.Name+"_Text")"

5
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml

@ -28,13 +28,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.Role.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.Role.GetProperty(propertyInfo.Name+"_Text")"

5
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml

@ -38,13 +38,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.Role.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Role.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.Role.GetProperty(propertyInfo.Name+"_Text")"

5
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml

@ -43,13 +43,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.UserInfo.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.UserInfo.GetProperty(propertyInfo.Name+"_Text")"

5
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml

@ -47,13 +47,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.UserInfo.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="UserInfo.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.UserInfo.GetProperty(propertyInfo.Name+"_Text")"

5
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml

@ -38,13 +38,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.Tenant.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.Tenant.GetProperty(propertyInfo.Name+"_Text")"

5
modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml

@ -24,13 +24,14 @@
{
if (!propertyInfo.Name.EndsWith("_Text"))
{
if (propertyInfo.Type.IsEnum || !propertyInfo.Lookup.Url.IsNullOrEmpty())
if (propertyInfo.IsEnum() || !propertyInfo.Lookup.Url.IsNullOrEmpty())
{
if (propertyInfo.Type.IsEnum)
if (propertyInfo.IsEnum())
{
Model.Tenant.ExtraProperties.ToEnum(propertyInfo.Name, propertyInfo.Type);
}
<abp-select asp-for="Tenant.ExtraProperties[propertyInfo.Name]"
enum-type="@propertyInfo.IsEnum() ? propertyInfo.Type : null"
label="@propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)"
autocomplete-api-url="@propertyInfo.Lookup.Url"
autocomplete-selected-item-name="@Model.Tenant.GetProperty(propertyInfo.Name+"_Text")"

Loading…
Cancel
Save