Tag helpers: isdisabled and readonly changes

pull/598/head
Yunus Emre Kalkan 6 years ago
parent 90ab39af28
commit b2a17134c4

@ -11,7 +11,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
public string Label { get; set; }
[HtmlAttributeName("disabled")]
public bool IsDisabled { get; set; }
public bool IsDisabled { get; set; } = false;
[HtmlAttributeName("readonly")]
public bool IsReadonly { get; set; } = false;
public bool AutoFocus { get; set; }

@ -139,9 +139,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
protected virtual void AddDisabledAttribute(TagHelperOutput inputTagHelperOutput)
{
var disabledAttribute = GetAttribute<DisabledInput>(TagHelper.AspFor.ModelExplorer);
if (disabledAttribute != null && !inputTagHelperOutput.Attributes.ContainsName("disabled"))
if (inputTagHelperOutput.Attributes.ContainsName("disabled"))
{
return;
}
else if (TagHelper.IsReadonly || GetAttribute<DisabledInput>(TagHelper.AspFor.ModelExplorer) != null)
{
inputTagHelperOutput.Attributes.Add("disabled", "");
}
@ -149,9 +151,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
protected virtual void AddReadOnlyAttribute(TagHelperOutput inputTagHelperOutput)
{
var readOnlyAttribute = GetAttribute<ReadOnlyInput>(TagHelper.AspFor.ModelExplorer);
if (readOnlyAttribute != null && !inputTagHelperOutput.Attributes.ContainsName("readonly"))
if (inputTagHelperOutput.Attributes.ContainsName("readonly"))
{
return;
}
else if (TagHelper.IsReadonly || GetAttribute<ReadOnlyInput>(TagHelper.AspFor.ModelExplorer) != null)
{
inputTagHelperOutput.Attributes.Add("readonly", "");
}
@ -246,7 +250,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
foreach (var tagHelperAttribute in tagHelperAttributes)
{
var nameWithoutPrefix = tagHelperAttribute.Name.Substring(groupPrefix.Length);
var newAttritube = new TagHelperAttribute(nameWithoutPrefix,tagHelperAttribute.Value);
var newAttritube = new TagHelperAttribute(nameWithoutPrefix, tagHelperAttribute.Value);
output.Attributes.Add(newAttritube);
}
}

Loading…
Cancel
Save