input tag helper: removed readonly plain text

resolved #700
pull/705/head
Yunus Emre Kalkan 6 years ago
parent 7a7342f21e
commit e8259d1517

@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
public bool IsDisabled { get; set; } = false;
[HtmlAttributeName("readonly")]
public AbpReadonlyInputType IsReadonly { get; set; } = AbpReadonlyInputType.False;
public bool? IsReadonly { get; set; } = false;
public bool AutoFocus { get; set; }

@ -143,16 +143,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
private void AddFormControlClass(TagHelperContext context, TagHelperOutput output, bool isCheckbox, TagHelperOutput inputTagHelperOutput)
{
var className = "form-control";
var readonlyAttribute = GetAttribute<ReadOnlyInput>(TagHelper.AspFor.ModelExplorer);
if (isCheckbox)
{
className = "form-check-input";
}
else if (TagHelper.IsReadonly == AbpReadonlyInputType.True_PlainText || (readonlyAttribute != null && readonlyAttribute.PlainText))
{
className = "form-control-plaintext";
}
inputTagHelperOutput.Attributes.AddClass(className + " " + GetSize(context, output));
}
@ -177,7 +172,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form
protected virtual void AddReadOnlyAttribute(TagHelperOutput inputTagHelperOutput)
{
if (inputTagHelperOutput.Attributes.ContainsName("readonly") == false &&
(TagHelper.IsReadonly != AbpReadonlyInputType.False || GetAttribute<ReadOnlyInput>(TagHelper.AspFor.ModelExplorer) != null))
(TagHelper.IsReadonly != false || GetAttribute<ReadOnlyInput>(TagHelper.AspFor.ModelExplorer) != null))
{
inputTagHelperOutput.Attributes.Add("readonly", "");
}

@ -301,7 +301,6 @@ public class DynamicFormsModel : PageModel
MyAttributeExamplesModel = new AttributeExamplesModel();
MyAttributeExamplesModel.DisabledInput = "Disabled Input";
MyAttributeExamplesModel.ReadonlyInput = "Readonly Input";
MyAttributeExamplesModel.ReadonlyPlainTextInput = "Readonly Plain Text Input";
MyAttributeExamplesModel.LargeInput = "Large Input";
MyAttributeExamplesModel.SmallInput = "Small Input";
}
@ -317,9 +316,6 @@ public class DynamicFormsModel : PageModel
[ReadOnlyInput]
public string ReadonlyInput { get; set; }
[ReadOnlyInput(PlainText = true)]
public string ReadonlyPlainTextInput { get; set; }
[FormControlSize(AbpFormControlSize.Large)]
public string LargeInput { get; set; }
@ -350,11 +346,6 @@ public class DynamicFormsModel : PageModel
&lt;input type=&quot;text&quot; id=&quot;MyAttributeExamplesModel_ReadonlyInput&quot; name=&quot;MyAttributeExamplesModel.ReadonlyInput&quot; value=&quot;Readonly Input&quot; class=&quot;form-control &quot; readonly=&quot;&quot;&gt;
&lt;span class=&quot;text-danger field-validation-valid&quot; data-valmsg-for=&quot;MyAttributeExamplesModel.ReadonlyInput&quot; data-valmsg-replace=&quot;true&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;form-group&quot;&gt;
&lt;label for=&quot;MyAttributeExamplesModel_ReadonlyPlainTextInput&quot;&gt;ReadonlyPlainTextInput&lt;/label&gt;
&lt;input type=&quot;text&quot; id=&quot;MyAttributeExamplesModel_ReadonlyPlainTextInput&quot; name=&quot;MyAttributeExamplesModel.ReadonlyPlainTextInput&quot; value=&quot;Readonly Plain Text Input&quot; class=&quot;form-control-plaintext &quot; readonly=&quot;&quot;&gt;
&lt;span class=&quot;text-danger field-validation-valid&quot; data-valmsg-for=&quot;MyAttributeExamplesModel.ReadonlyPlainTextInput&quot; data-valmsg-replace=&quot;true&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;form-group&quot;&gt;
&lt;label for=&quot;MyAttributeExamplesModel_LargeInput&quot;&gt;LargeInput&lt;/label&gt;
&lt;input type=&quot;text&quot; id=&quot;MyAttributeExamplesModel_LargeInput&quot; name=&quot;MyAttributeExamplesModel.LargeInput&quot; value=&quot;Large Input&quot; class=&quot;form-control form-control-lg&quot;&gt;

@ -51,7 +51,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components
{
DisabledInput = "Disabled Input",
ReadonlyInput = "Readonly Input",
ReadonlyPlainTextInput = "Readonly Plain Text Input",
LargeInput = "Large Input",
SmallInput = "Small Input"
};
@ -74,9 +73,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components
[ReadOnlyInput]
public string ReadonlyInput { get; set; }
[ReadOnlyInput(PlainText = true)]
public string ReadonlyPlainTextInput { get; set; }
[FormControlSize(AbpFormControlSize.Large)]
public string LargeInput { get; set; }

@ -239,8 +239,7 @@
<div class="demo-with-code">
<div class="demo-area">
<abp-input asp-for="@Model.MyModel.SampleInput0" disabled="true" />
<abp-input asp-for="@Model.MyModel.SampleInput1" readonly="True" />
<abp-input asp-for="@Model.MyModel.SampleInput2" readonly="True_PlainText"/>
<abp-input asp-for="@Model.MyModel.SampleInput1" readonly="true" />
</div>
<div class="code-area">
<abp-tabs>
@ -256,7 +255,6 @@
MyModel.SampleInput0 = "This is a disabled input.";
MyModel.SampleInput0 = "This is a disabled input.";
MyModel.SampleInput1 = "This is a readonly input.";
MyModel.SampleInput2 = "This is a readonly plain-text.";
}
public class SampleModel
@ -274,7 +272,6 @@
<pre><code>
&lt;abp-input asp-for=&quot;@@Model.MyModel.SampleInput0&quot; disabled=&quot;true&quot; /&gt;
&lt;abp-input asp-for=&quot;@@Model.MyModel.SampleInput1&quot; readonly=&quot;True&quot; /&gt;
&lt;abp-input asp-for=&quot;@@Model.MyModel.SampleInput2&quot; readonly=&quot;True_PlainText&quot;/&gt;
</code></pre>
</abp-tab>
<abp-tab title="Rendered">
@ -289,11 +286,6 @@
&lt;input type=&quot;text&quot; id=&quot;MyModel_SampleInput1&quot; name=&quot;MyModel.SampleInput1&quot; value=&quot;This is a readonly input.&quot; class=&quot;form-control &quot; readonly=&quot;&quot;&gt;
&lt;span class=&quot;text-danger field-validation-valid&quot; data-valmsg-for=&quot;MyModel.SampleInput1&quot; data-valmsg-replace=&quot;true&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
&lt;div class=&quot;form-group&quot;&gt;
&lt;label for=&quot;MyModel_SampleInput2&quot;&gt;SampleInput2&lt;/label&gt;
&lt;input type=&quot;text&quot; id=&quot;MyModel_SampleInput2&quot; name=&quot;MyModel.SampleInput2&quot; value=&quot;This is a readonly plain-text.&quot; class=&quot;form-control-plaintext &quot; readonly=&quot;&quot;&gt;
&lt;span class=&quot;text-danger field-validation-valid&quot; data-valmsg-for=&quot;MyModel.SampleInput2&quot; data-valmsg-replace=&quot;true&quot;&gt;&lt;/span&gt;
&lt;/div&gt;
</code></pre>
</abp-tab>
</abp-tabs>

@ -27,7 +27,6 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Pages.Components
MyModel = new SampleModel();
MyModel.SampleInput0 = "This is a disabled input.";
MyModel.SampleInput1 = "This is a readonly input.";
MyModel.SampleInput2 = "This is a readonly plain-text.";
MyModel.CityRadio = "IST";
}

Loading…
Cancel
Save