Browse Source

Merge branch 'dev' into issue-3807/L

pull/19126/head
honurbu 2 years ago
parent
commit
8ed769c64b
  1. 2
      .github/ISSUE_TEMPLATE/config.yml
  2. 4
      docs/en/Modules/Tenant-Management.md
  3. 29
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs
  4. 8
      framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs
  5. 19
      framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToEnum_Tests.cs

2
.github/ISSUE_TEMPLATE/config.yml

@ -2,7 +2,7 @@ blank_issues_enabled: true
contact_links:
- name: Issue with ABP Commercial
url: https://support.abp.io/QA/Questions
about: Please open issues relating to ABP Commercial in support.abp.io.
about: Please open ABP Commercial related issues at https://support.abp.io.
- name: Ask a question (community support)
url: https://stackoverflow.com/questions/tagged/abp
about: Ask a question that will be answered by the ABP community

4
docs/en/Modules/Tenant-Management.md

@ -56,7 +56,7 @@ This module defines the following ETOs (Event Transfer Objects) to allow you to
**Example: Get notified when a new tenant has been created**
```
```cs
public class MyHandler :
IDistributedEventHandler<EntityCreatedEto<TenantEto>>,
ITransientDependency
@ -131,4 +131,4 @@ ABP Framework allows to use *database per tenant* approach that allows a tenant
## See Also
* [Multi-Tenancy](../Multi-Tenancy.md)
* [ABP Commercial SaaS Module](https://docs.abp.io/en/commercial/latest/modules/saas)
* [ABP Commercial SaaS Module](https://docs.abp.io/en/commercial/latest/modules/saas)

29
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs

@ -54,19 +54,22 @@ public class AbpInputTagHelperService : AbpTagHelperService<AbpInputTagHelper>
output.TagMode = TagMode.StartTagAndEndTag;
output.TagName = "div";
LeaveOnlyGroupAttributes(context, output);
if (TagHelper.FloatingLabel && !isCheckBox)
if (!IsOutputHidden(output))
{
output.Attributes.AddClass("form-floating");
}
if (TagHelper.AddMarginBottomClass)
{
output.Attributes.AddClass(isCheckBox ? "mb-2" : "mb-3");
}
if (isCheckBox)
{
output.Attributes.AddClass("custom-checkbox");
output.Attributes.AddClass("custom-control");
output.Attributes.AddClass("form-check");
if (TagHelper.FloatingLabel && !isCheckBox)
{
output.Attributes.AddClass("form-floating");
}
if (TagHelper.AddMarginBottomClass)
{
output.Attributes.AddClass(isCheckBox ? "mb-2" : "mb-3");
}
if (isCheckBox)
{
output.Attributes.AddClass("custom-checkbox");
output.Attributes.AddClass("custom-control");
output.Attributes.AddClass("form-check");
}
}
output.Content.AppendHtml(innerHtml);
}
@ -263,7 +266,7 @@ public class AbpInputTagHelperService : AbpTagHelperService<AbpInputTagHelper>
}
protected virtual async Task<string> GetLabelAsHtmlAsync(TagHelperContext context, TagHelperOutput output, TagHelperOutput inputTag, bool isCheckbox)
{
{
if (IsOutputHidden(inputTag) || TagHelper.SuppressLabel)
{
return string.Empty;

8
framework/src/Volo.Abp.Json.SystemTextJson/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs

@ -11,6 +11,8 @@ public class AbpStringToEnumConverter<T> : JsonConverter<T>
private JsonSerializerOptions? _readJsonSerializerOptions;
private JsonSerializerOptions? _writeJsonSerializerOptions;
public AbpStringToEnumConverter()
: this(namingPolicy: null, allowIntegerValues: true)
{
@ -39,7 +41,11 @@ public class AbpStringToEnumConverter<T> : JsonConverter<T>
public override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value);
_writeJsonSerializerOptions ??= JsonSerializerOptionsHelper.Create(options, x =>
x == this ||
x.GetType() == typeof(AbpStringToEnumFactory));
JsonSerializer.Serialize(writer, value, _writeJsonSerializerOptions);
}
public override T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)

19
framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToEnum_Tests.cs

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text.Json;
using System.Text.Json.Serialization;
using Shouldly;
using Volo.Abp.Json.SystemTextJson.JsonConverters;
using Xunit;
@ -53,10 +54,26 @@ public class AbpStringToEnum_Tests
var testClassJson = JsonSerializer.Serialize(new TestClass()
{
Day = DayOfWeek.Monday
});
}, options);
testClassJson.ShouldBe("{\"Day\":1}");
options = new JsonSerializerOptions()
{
Converters =
{
new AbpStringToEnumFactory(),
new JsonStringEnumConverter()
}
};
testClassJson = JsonSerializer.Serialize(new TestClass()
{
Day = DayOfWeek.Monday
}, options);
testClassJson.ShouldBe("{\"Day\":\"Monday\"}");
testClassJson = JsonSerializer.Serialize(new Dictionary<DayOfWeek, string>
{
{DayOfWeek.Monday, "Mo"}

Loading…
Cancel
Save