Localize non components for the profiles pages

This commit is contained in:
hishamco 2020-11-20 00:37:10 +03:00
parent 387c1aa57f
commit fcfcd46d8e
2 changed files with 96 additions and 93 deletions

View File

@ -2,97 +2,98 @@
@inherits ModuleBase @inherits ModuleBase
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IProfileService ProfileService @inject IProfileService ProfileService
@inject IStringLocalizer<Edit> Localizer
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<Label For="name" HelpText="The name of this profile item" ResourceKey="Name">Name: </Label> <Label For="name" HelpText="The name of this profile item" ResourceKey="Name">Name: </Label>
</td> </td>
<td> <td>
<input id="name" class="form-control" @bind="@_name" /> <input id="name" class="form-control" @bind="@_name" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="title" HelpText="The title of the profile item to display to the user" ResourceKey="Title">Title: </Label> <Label For="title" HelpText="The title of the profile item to display to the user" ResourceKey="Title">Title: </Label>
</td> </td>
<td> <td>
<input id="title" class="form-control" @bind="@_title" /> <input id="title" class="form-control" @bind="@_title" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="description" HelpText="The help text displayed to the user for this profile item" ResourceKey="Description">Description: </Label> <Label For="description" HelpText="The help text displayed to the user for this profile item" ResourceKey="Description">Description: </Label>
</td> </td>
<td> <td>
<textarea id="description" class="form-control" @bind="@_description" rows="5"></textarea> <textarea id="description" class="form-control" @bind="@_description" rows="5"></textarea>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="category" HelpText="The category of this profile item (for grouping)" ResourceKey="Category">Category: </Label> <Label For="category" HelpText="The category of this profile item (for grouping)" ResourceKey="Category">Category: </Label>
</td> </td>
<td> <td>
<input id="category" class="form-control" @bind="@_category" /> <input id="category" class="form-control" @bind="@_category" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="order" HelpText="The index order of where this profile item should be displayed" ResourceKey="Order">Order: </Label> <Label For="order" HelpText="The index order of where this profile item should be displayed" ResourceKey="Order">Order: </Label>
</td> </td>
<td> <td>
<input id="order" class="form-control" @bind="@_vieworder" /> <input id="order" class="form-control" @bind="@_vieworder" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="length" HelpText="The max number of characters this profile item should accept (enter zero for unlimited)" ResourceKey="Length">Length: </Label> <Label For="length" HelpText="The max number of characters this profile item should accept (enter zero for unlimited)" ResourceKey="Length">Length: </Label>
</td> </td>
<td> <td>
<input id="length" class="form-control" @bind="@_maxlength" /> <input id="length" class="form-control" @bind="@_maxlength" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="defaultVal" HelpText="The default value for this profile item" ResourceKey="DefaultValue">Default Value: </Label> <Label For="defaultVal" HelpText="The default value for this profile item" ResourceKey="DefaultValue">Default Value: </Label>
</td> </td>
<td> <td>
<input id="defaultVal" class="form-control" @bind="@_defaultvalue" /> <input id="defaultVal" class="form-control" @bind="@_defaultvalue" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="options" HelpText="A comma delimited list of options the user can select from" ResourceKey="Options">Options: </Label> <Label For="options" HelpText="A comma delimited list of options the user can select from" ResourceKey="Options">Options: </Label>
</td> </td>
<td> <td>
<input id="options" class="form-control" @bind="@_options" /> <input id="options" class="form-control" @bind="@_options" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="required" HelpText="Should a user be required to provide a value for this profile item?" ResourceKey="Required">Required? </Label> <Label For="required" HelpText="Should a user be required to provide a value for this profile item?" ResourceKey="Required">Required? </Label>
</td> </td>
<td> <td>
<select id="required" class="form-control" @bind="@_isrequired"> <select id="required" class="form-control" @bind="@_isrequired">
<option value="True">Yes</option> <option value="True">@Localizer["Yes"]</option>
<option value="False">No</option> <option value="False">@Localizer["No"]</option>
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="private" HelpText="Should this profile item be visible to all users?" ResourceKey="Private">Private? </Label> <Label For="private" HelpText="Should this profile item be visible to all users?" ResourceKey="Private">Private? </Label>
</td> </td>
<td> <td>
<select id="private" class="form-control" @bind="@_isprivate"> <select id="private" class="form-control" @bind="@_isprivate">
<option value="True">Yes</option> <option value="True">@Localizer["Yes"]</option>
<option value="False">No</option> <option value="False">@Localizer["No"]</option>
</select> </select>
</td> </td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-success" @onclick="SaveProfile">Save</button> <button type="button" class="btn btn-success" @onclick="SaveProfile">@Localizer["Save"]</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
@code { @code {
private int _profileid = -1; private int _profileid = -1;
@ -169,7 +170,8 @@
if (_profileid != -1) if (_profileid != -1)
{ {
profile = await ProfileService.UpdateProfileAsync(profile); profile = await ProfileService.UpdateProfileAsync(profile);
}else }
else
{ {
profile = await ProfileService.AddProfileAsync(profile); profile = await ProfileService.AddProfileAsync(profile);
} }

View File

@ -1,10 +1,11 @@
@namespace Oqtane.Modules.Admin.Profiles @namespace Oqtane.Modules.Admin.Profiles
@inherits ModuleBase @inherits ModuleBase
@inject IProfileService ProfileService @inject IProfileService ProfileService
@inject IStringLocalizer<Index> Localizer
@if (_profiles == null) @if (_profiles == null)
{ {
<p><em>Loading...</em></p> <p><em>@Localizer["Loading..."]</em></p>
} }
else else
{ {
@ -14,7 +15,7 @@ else
<Header> <Header>
<th style="width: 1px;">&nbsp;</th> <th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th> <th style="width: 1px;">&nbsp;</th>
<th>Name</th> <th>@Localizer["Name"]</th>
</Header> </Header>
<Row> <Row>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ProfileId.ToString())" ResourceKey="EditProfile" /></td> <td><ActionLink Action="Edit" Parameters="@($"id=" + context.ProfileId.ToString())" ResourceKey="EditProfile" /></td>