Skip to content

Commit

Permalink
Merge pull request #4895 from tvatavuk/enh-4883-control-panel
Browse files Browse the repository at this point in the history
Add ShowEditMode parameter to ControlPanel to allow hiding the Edit Mode toggle button
  • Loading branch information
sbwalker authored Dec 4, 2024
2 parents 8a7c2ce + b2a7b81 commit 2c721ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 8 additions & 2 deletions Oqtane.Client/Themes/Controls/Theme/ControlPanel.razor
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<LanguageSwitcher ButtonClass="@ButtonClass" DropdownAlignment="@LanguageDropdownAlignment" />
}

@if (_showEditMode || (PageState.Page.IsPersonalizable && PageState.User != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Registered)))
@if (ShowEditMode && (_showEditMode || (PageState.Page.IsPersonalizable && PageState.User != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Registered))))
{
<form method="post" class="app-form-inline" @formname="EditModeForm" @onsubmit="@(async () => await ToggleEditMode(PageState.EditMode))" data-enhance>
<input type="hidden" name="@Constants.RequestVerificationToken" value="@SiteState.AntiForgeryToken" />
Expand Down Expand Up @@ -59,9 +59,15 @@
[Parameter]
public string LanguageDropdownAlignment { get; set; } = string.Empty; // Empty or Left or Right
/// <summary>
/// Ability to hide the Edit Mode toggle button
/// </summary>
[Parameter]
public bool ShowEditMode { get; set; } = true;

private PageState _pageState;
private bool _canViewAdminDashboard = false;
private bool _showEditMode = false;
private bool _showEditMode = false; // internal state (not the same as ShowEditMode parameter)
protected override void OnParametersSet()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
@inject ILogService LoggingService
@inject IStringLocalizer<ControlPanelInteractive> Localizer
@inject IStringLocalizer<SharedResources> SharedLocalizer
@inject IServiceProvider ServiceProvider

<button type="button" class="btn @ButtonClass ms-1" data-bs-toggle="offcanvas" data-bs-target="#offcanvasControlPanel" aria-controls="offcanvasControlPanel" @onclick="ClearMessage">
<span class="oi oi-cog"></span>
Expand Down

0 comments on commit 2c721ad

Please sign in to comment.