-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c98eb07
commit 5cac5ff
Showing
16 changed files
with
147 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/BlazorApp/Aguacongas.TheIdServer.BlazorApp.Components/CultureInfos.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@using System.Globalization | ||
@inherits AutoCompleteModel<CultureInfo> | ||
|
||
<div class="input-group" data-toggle="dropdown"> | ||
<input id="@Id" type="text" class="form-control @FieldClass" placeholder="@Localizer["culture"]" value="@Entity.Name" | ||
@oninput="OnInputChanged" @onfocus="() => OnInputChanged(new ChangeEventArgs { Value = Entity.Name })" /> | ||
</div> | ||
<div class="dropdown-menu m-0"> | ||
@if (_filterValues != null) | ||
{ | ||
foreach (var value in _filterValues) | ||
{ | ||
<button class="dropdown-item m-0 p-0 pl-1 pr-1" type="button" @onclick="() => SetSelectedValue(value.Name)"> | ||
@value.Name | ||
<div> | ||
<em><small>@value.DisplayName</small></em> | ||
</div> | ||
</button> | ||
} | ||
} | ||
</div> |
36 changes: 36 additions & 0 deletions
36
src/BlazorApp/Aguacongas.TheIdServer.BlazorApp.Components/CultureInfos.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
|
||
namespace Aguacongas.TheIdServer.BlazorApp.Components | ||
{ | ||
public partial class CultureInfos | ||
{ | ||
private IEnumerable<CultureInfo> _filterValues; | ||
protected override bool IsReadOnly => false; | ||
|
||
protected override string PropertyName => "Name"; | ||
|
||
protected override Task<IEnumerable<string>> GetFilteredValues(string term) | ||
{ | ||
term = term ?? string.Empty; | ||
_filterValues = CultureInfo.GetCultures(CultureTypes.AllCultures) | ||
.Where(c => c.Name.Contains(term, StringComparison.OrdinalIgnoreCase) || c.DisplayName.Contains(term, StringComparison.OrdinalIgnoreCase)) | ||
.Take(5); | ||
|
||
return Task.FromResult(_filterValues.Select(c => c.Name)); | ||
} | ||
|
||
protected override void SetValue(string inputValue) | ||
{ | ||
var cultureInfo = CultureInfo.GetCultures(CultureTypes.AllCultures) | ||
.FirstOrDefault(c => c.Name == inputValue); | ||
if (cultureInfo != null) | ||
{ | ||
Entity = cultureInfo; | ||
} | ||
} | ||
} | ||
} |
15 changes: 12 additions & 3 deletions
15
src/BlazorApp/Aguacongas.TheIdServer.BlazorApp.Components/EntityResourceTranslatation.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters