Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Visible with ShowLanguageSwitcher property #990

Merged
merged 1 commit into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Oqtane.Client/Themes/Controls/ControlPanel.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@inject IPageModuleService PageModuleService
@inject ILogService logger
@inject ISettingService SettingService
@inject IStringLocalizer<ControlPanel> Localizer
@inject IStringLocalizer<ControlPanel> Localizer

@if (_moduleDefinitions != null && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
{
Expand Down Expand Up @@ -198,7 +198,10 @@
</div>
}

<LanguageSwitcher />
@if (ShowLanguageSwitcher)
{
<LanguageSwitcher />
}

@if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
{
Expand Down Expand Up @@ -289,6 +292,9 @@
[Parameter]
public string BodyClass { get; set; } = "card-body";

[Parameter]
public bool ShowLanguageSwitcher { get; set; } = true;


protected override async Task OnInitializedAsync()
{
Expand Down Expand Up @@ -316,12 +322,12 @@

private void CategoryChanged(ChangeEventArgs e)
{
Category = (string) e.Value;
Category = (string)e.Value;
}

private void ModuleChanged(ChangeEventArgs e)
{
ModuleDefinitionName = (string) e.Value;
ModuleDefinitionName = (string)e.Value;
if (ModuleDefinitionName != "-")
{
var moduleDefinition = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == ModuleDefinitionName);
Expand All @@ -337,7 +343,7 @@

private void PageChanged(ChangeEventArgs e)
{
PageId = (string) e.Value;
PageId = (string)e.Value;
if (PageId != "-")
{
_modules = PageState.Modules
Expand Down
5 changes: 1 addition & 4 deletions Oqtane.Client/Themes/Controls/LanguageSwitcher.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@inject ILocalizationService LocalizationService
@inject NavigationManager NavigationManager

@if (_supportedCultures != null && Visible)
@if (_supportedCultures != null)
{
<div class="btn-group" role="group">
<button id="btnCultures" type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Expand All @@ -24,9 +24,6 @@
@code{
private IEnumerable<Culture> _supportedCultures;

[Parameter]
public bool Visible { get; set; } = true;

protected override async Task OnParametersSetAsync()
{
_supportedCultures = await LocalizationService.GetCulturesAsync();
Expand Down