Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamicFormTagHelper add Column attribute #16111

Merged
merged 5 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/en/UI/AspNetCore/Tag-Helpers/Dynamic-Forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ See the [dynamic forms demo page](https://bootstrap-taghelpers.abp.io/Components

Sets the c# model for dynamic form. Properties of this modal are turned into inputs in the form.

### abp-column
### column-size

Set up columns in a dynamic form. The value is between 1~6 .
Here, use 'col-sm' to set the size . When setting this property 'col-12' will be added at the same time.

### submit-button

Expand Down
4 changes: 2 additions & 2 deletions docs/zh-Hans/UI/AspNetCore/Tag-Helpers/Dynamic-Forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ public class DynamicFormsModel : PageModel

为动态表单设置c#模型,模型的属性以表单形式转化为输入.

### abp-column
### column-size

设置动态表单控件展示列数,值范围:1~6.
此处使用 `col-sm` 来设置大小。当设置该属性是会同时添加 `col-12` .

### submit-button

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid;

namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;

Expand All @@ -12,8 +13,8 @@ public class AbpDynamicFormTagHelper : AbpTagHelper<AbpDynamicFormTagHelper, Abp
[HtmlAttributeName("abp-model")]
public ModelExpression Model { get; set; }

[HtmlAttributeName("abp-column")]
public int Column { get; set; }
[HtmlAttributeName("column-size")]
public ColumnSize ColumnSize { get; set; }

public bool? SubmitButton { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Microsoft.AspNetCore.Razor.TagHelpers;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Button;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Extensions;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid;

namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form;

Expand Down Expand Up @@ -121,12 +122,12 @@ protected virtual void SetContent(TagHelperContext context, TagHelperOutput outp

protected virtual string SetColumn(string htmlContent)
{
if (TagHelper.Column < 2 || TagHelper.Column > 6)
if (TagHelper.ColumnSize == ColumnSize.Undefined || TagHelper.ColumnSize == ColumnSize._)
{
return htmlContent;
}

var col_class = $"col-12 col-sm-" + (12 / TagHelper.Column);
var col_class = $"col-12 col-sm-" + TagHelper.ColumnSize;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tink it should be ((int) TagHelper.ColumnSize)


return $"<div class=\"{col_class}\">{htmlContent}</div>";
}
Expand Down