modifications for Bootstrap 5
This commit is contained in:
		| @ -6,35 +6,28 @@ | ||||
| @inject IStringLocalizer<SharedResources> SharedLocalizer | ||||
|  | ||||
| <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate> | ||||
|     <table class="table table-borderless"> | ||||
|         <tr> | ||||
|             <td width="30%"> | ||||
|                 <Label For="name" HelpText="Name Of The Role" ResourceKey="Name">Name:</Label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <input id="name" class="form-control" @bind="@_name" maxlength="256" required /> | ||||
|             </td> | ||||
|         </tr> | ||||
|         <tr> | ||||
|             <td> | ||||
|                 <Label For="description" HelpText="A Short Description Of The Role Which Describes Its Purpose" ResourceKey="Description">Description:</Label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <textarea id="description" class="form-control" @bind="@_description" rows="5" maxlength="256" required></textarea> | ||||
|             </td> | ||||
|         </tr> | ||||
|         <tr> | ||||
|             <td> | ||||
|                 <Label For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role" ResourceKey="AutoAssigned">Auto Assigned?</Label> | ||||
|             </td> | ||||
|             <td> | ||||
|                 <select id="isautoassigned" class="form-select" @bind="@_isautoassigned"> | ||||
|                     <option value="True">@SharedLocalizer["Yes"]</option> | ||||
|                     <option value="False">@SharedLocalizer["No"]</option> | ||||
|                 </select> | ||||
|             </td> | ||||
|         </tr> | ||||
|     </table> | ||||
|     <div class="row mb-1 align-items-center"> | ||||
|         <Label Class="col-sm-3" For="name" HelpText="Name Of The Role" ResourceKey="Name">Name:</Label> | ||||
|         <div class="col-sm-9"> | ||||
|             <input id="name" class="form-control" @bind="@_name" maxlength="256" required /> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="row mb-1 align-items-center"> | ||||
|         <Label Class="col-sm-3" For="description" HelpText="A Short Description Of The Role Which Describes Its Purpose" ResourceKey="Description">Description:</Label> | ||||
|         <div class="col-sm-9"> | ||||
|             <textarea id="description" class="form-control" @bind="@_description" rows="5" maxlength="256" required></textarea> | ||||
|         </div> | ||||
|     </div> | ||||
|     <div class="row mb-1 align-items-center"> | ||||
|         <Label Class="col-sm-3" For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role" ResourceKey="AutoAssigned">Auto Assigned?</Label> | ||||
|         <div class="col-sm-9"> | ||||
|             <select id="isautoassigned" class="form-select" @bind="@_isautoassigned"> | ||||
|                 <option value="True">@SharedLocalizer["Yes"]</option> | ||||
|                 <option value="False">@SharedLocalizer["No"]</option> | ||||
|             </select> | ||||
|         </div> | ||||
|     </div> | ||||
|     <br /><br /> | ||||
|     <button type="button" class="btn btn-success" @onclick="SaveRole">@SharedLocalizer["Save"]</button> | ||||
|     <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink> | ||||
| </form> | ||||
|  | ||||
| @ -3,17 +3,16 @@ | ||||
|  | ||||
| @if (!string.IsNullOrEmpty(HelpText)) | ||||
| { | ||||
|     <span class="app-tooltip" data-tip="@((MarkupString)HelpText)">@((MarkupString)_openLabel)@ChildContent@((MarkupString)_closeLabel) <img src="images/help.png" /></span> | ||||
|     <span class="@_spanclass" data-tip="@((MarkupString)@_helptext)"> | ||||
|         <label for="@For" class="@_labelclass">@ChildContent</label> <img src="images/help.png" /> | ||||
|     </span> | ||||
| } | ||||
| else | ||||
| { | ||||
|     @((MarkupString)_openLabel)@ChildContent@((MarkupString)_closeLabel) | ||||
|     <label for="@For" class="@_labelclass">@ChildContent</label> | ||||
| } | ||||
|  | ||||
| @code { | ||||
|     private string _openLabel = string.Empty; | ||||
|     private string _closeLabel = "</label>"; | ||||
|  | ||||
|     [Parameter] | ||||
|     public RenderFragment ChildContent { get; set; } | ||||
|  | ||||
| @ -21,39 +20,33 @@ else | ||||
|     public string For { get; set; } // optional - the id of the associated input control for accessibility | ||||
|  | ||||
|     [Parameter] | ||||
|     public string Class { get; set; } // optional - the class for the label ( ie. control-label ) | ||||
|     public string Class { get; set; } // optional - CSS classes | ||||
|  | ||||
|     [Parameter] | ||||
|     public string HelpText { get; set; } // optional - tooltip for this label | ||||
|  | ||||
|     private string _spanclass = "app-tooltip"; | ||||
|     private string _labelclass = "form-label"; | ||||
|     private string _helptext = string.Empty; | ||||
|  | ||||
|     protected override void OnParametersSet() | ||||
|     { | ||||
|         base.OnParametersSet(); | ||||
|  | ||||
|         if (string.IsNullOrEmpty(Class)) | ||||
|         if (!string.IsNullOrEmpty(HelpText)) | ||||
|         { | ||||
|             Class = "form-label"; | ||||
|             _helptext = Localize(nameof(HelpText), HelpText); | ||||
|             _spanclass += (!string.IsNullOrEmpty(Class)) ? " " + Class : ""; | ||||
|         } | ||||
|  | ||||
|         _openLabel = "<label"; | ||||
|         if (!string.IsNullOrEmpty(For)) | ||||
|         else | ||||
|         { | ||||
|             _openLabel += " for=\"" + For + "\""; | ||||
|             _labelclass += (!string.IsNullOrEmpty(Class)) ? " " + Class : ""; | ||||
|         } | ||||
|  | ||||
|         if (!string.IsNullOrEmpty(Class)) | ||||
|         { | ||||
|             _openLabel += " class=\"" + Class + "\""; | ||||
|         } | ||||
|  | ||||
|         _openLabel += ">"; | ||||
|  | ||||
|         var text = Localize("Text", String.Empty); | ||||
|         if (text != String.Empty) | ||||
|         if (!string.IsNullOrEmpty(text)) | ||||
|         { | ||||
|             ChildContent =@<text>@text</text>; | ||||
|         } | ||||
|  | ||||
|         HelpText = Localize(nameof(HelpText), HelpText); | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker