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

[ENH] Oqtane ControlPanel component forces edit button unto page #4883

Closed
iJungleboy opened this issue Nov 28, 2024 · 4 comments · Fixed by #4895
Closed

[ENH] Oqtane ControlPanel component forces edit button unto page #4883

iJungleboy opened this issue Nov 28, 2024 · 4 comments · Fixed by #4895

Comments

@iJungleboy
Copy link
Contributor

Oqtane Info

Version - 5.x up to 6.0
Render Mode - all
Interactivity - Server
Database - SQL Server

Describe the bug

The razor component ControlPanel should be responsible for making the control panel available.
But it also forces a visible edit button unto the page, which is not desirable, because this makes it impossible to create your own.

Here's an example: in both cases there is a customized toolbar (custom languages, custom buttons) but the forced edit still appears (languages could be disabled).

image

image

Expected Behavior

Either

  1. The edit button is a separate control which can be added as needed
  2. or the ControlPanel has a ShowEditToggle parameter (just like ShowLanguageSwitcher) to allow not having that button

My recommendation would be to keep concerns separate, and not combine these controls. But because I assume "the ship has sailed" we should probably just add the toggle.

Anything else?

I would be happy to contribute the fix, but must be sure that it would be accepted, and that the naming for this Parameter is according to your expectations.

@sbwalker
Copy link
Member

sbwalker commented Dec 1, 2024

This is not a bug... the Control Panel component has had this behavior since version 1.0 (ie. since 2020). If a developer does not like the default behavior of the Control Panel component, they have always had the flexibility to create their own custom Control Panel component. The ability to hide the Edit Mode toggle can certainly be added as an enhancement to the existing Control Panel component - as long as the default value is False (so that it does not affect existing installations).

@iJungleboy
Copy link
Contributor Author

@sbwalker sounds good, I'll commit some code.

What would you like for a property name - just so I don't use a different naming convention?

@sbwalker sbwalker changed the title [BUG] Oqtane ControlPanel component forces edit button unto page [ENH] Oqtane ControlPanel component forces edit button unto page Dec 2, 2024
@sbwalker
Copy link
Member

sbwalker commented Dec 2, 2024

There is already a ShowLanguageSwitcher property so I would suggest a ShowEditMode property (default to True). However please be very careful when adding this enhancement so that the current behavior is not affected. The EditMode button is more complex than it appears as it supports both static and interactive render modes, is displayed based on a number of different business rules, and is also used as part of page personalization (ie. the ability to create a custom page for an individual user).

@tvatavuk
Copy link
Contributor

tvatavuk commented Dec 4, 2024

Summary

  • Introduced ShowEditMode parameter in ControlPanel.
  • Default value is true; existing behavior remains unchanged.
  • Tested with default and modified themes, across different users and render modes.
  • Confirmed that the Edit Mode toggle button can now be hidden when ShowEditMode is set to false.

Tests

Here are the test cases for each combination of user type and render variation:

Group 1: Default Themes Preserving Existing Behavior

Test Case 1

  • Title: Anonymous User - Static Server Render - Oqtane Default Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Oqtane Default theme with static server-side rendering.
    image

Test Case 2

  • Title: Admin User - Static Server Render - Oqtane Default Theme
  • Expected Result:
    The Edit Mode toggle button is visible to the admin user. The admin can toggle Edit Mode as expected. The page renders correctly using the Oqtane Default theme with static server-side rendering.
    image

Test Case 3

  • Title: Anonymous User - Static Client Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor Default theme with static client-side rendering.
    image

Test Case 4

  • Title: Admin User - Static Client Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is visible to the admin user. The admin can toggle Edit Mode as expected. The page renders correctly using the Blazor Default theme with static client-side rendering.
    image

Test Case 5

  • Title: Anonymous User - Static Auto Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor Default theme with static auto rendering.
    image

Test Case 6

  • Title: Admin User - Static Auto Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is visible to the admin user. The admin can toggle Edit Mode as expected. The page renders correctly using the Blazor Default theme with static auto rendering.
    image

Test Case 7

  • Title: Anonymous User - Interactive Server Render - Oqtane Default Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Oqtane Default theme with interactive server-side rendering.
    image

Test Case 8

  • Title: Admin User - Interactive Server Render - Oqtane Default Theme
  • Expected Result:
    The Edit Mode toggle button is visible to the admin user. The admin can toggle Edit Mode as expected. The page renders correctly using the Oqtane Default theme with interactive server-side rendering.
    image

Test Case 9

  • Title: Anonymous User - Interactive Client Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor Default theme with interactive client-side rendering.
    image

Test Case 10

  • Title: Admin User - Interactive Client Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is visible to the admin user. The admin can toggle Edit Mode as expected. The page renders correctly using the Blazor Default theme with interactive client-side rendering.
    image

Test Case 11

  • Title: Anonymous User - Interactive Auto Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor Default theme with interactive auto rendering.
    image

Test Case 12

  • Title: Admin User - Interactive Auto Render - Blazor Default Theme
  • Expected Result:
    The Edit Mode toggle button is visible to the admin user. The admin can toggle Edit Mode as expected. The page renders correctly using the Blazor Default theme with interactive auto rendering.
    image

Group 2: Test Themes Showing New Behavior with ShowEditMode="false"

Test Case 13

  • Title: Anonymous User - Static Server Render - Oqtane DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Oqtane DefaultHideEditToggle theme with static server-side rendering.
    image

Test Case 14

  • Title: Admin User - Static Server Render - Oqtane DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the admin user. Despite being an admin, the toggle is hidden due to the theme setting ShowEditMode="false". The page renders correctly.
    image

Test Case 15

  • Title: Anonymous User - Static Client Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor DefaultHideEditToggle theme with static client-side rendering.
    image

Test Case 16

  • Title: Admin User - Static Client Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the admin user. The toggle is hidden due to the theme setting. The page renders correctly.
    image

Test Case 17

  • Title: Anonymous User - Static Auto Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor DefaultHideEditToggle theme with static auto rendering.
    image

Test Case 18

  • Title: Admin User - Static Auto Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the admin user. The toggle is hidden due to the theme setting. The page renders correctly.
    image

Test Case 19

  • Title: Anonymous User - Interactive Server Render - Oqtane DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Oqtane DefaultHideEditToggle theme with interactive server-side rendering.
    image

Test Case 20

  • Title: Admin User - Interactive Server Render - Oqtane DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the admin user. The toggle is hidden due to the theme setting. The page renders correctly.
    image

Test Case 21

  • Title: Anonymous User - Interactive Client Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor DefaultHideEditToggle theme with interactive client-side rendering.
    image

Test Case 22

  • Title: Admin User - Interactive Client Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the admin user. The toggle is hidden due to the theme setting. The page renders correctly.
    image

Test Case 23

  • Title: Anonymous User - Interactive Auto Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the anonymous user. The page renders correctly using the Blazor DefaultHideEditToggle theme with interactive auto rendering.
    image

Test Case 24

  • Title: Admin User - Interactive Auto Render - Blazor DefaultHideEditToggle Theme
  • Expected Result:
    The Edit Mode toggle button is not visible to the admin user. The toggle is hidden due to the theme setting. The page renders correctly.
    image

Comment

Each test case ensures that the addition of the ShowEditMode parameter functions as intended, either preserving the existing behavior in default themes or demonstrating the new behavior in modified themes where the Edit Mode toggle button is hidden.

Note:

  • In all test cases with the default themes (Test Cases 1-12), the existing behavior is preserved:
    • Anonymous Users: Edit Mode toggle button is not visible.
    • Admin Users: Edit Mode toggle button is visible and functional.
  • In all test cases with the modified themes using ShowEditMode="false" (Test Cases 13-24), the new behavior is exhibited:
    • Both Anonymous and Admin Users: Edit Mode toggle button is not visible due to the theme configuration.

These test cases cover all combinations of user types and render variations, ensuring thorough validation of the enhancement implemented for issue #4883.

Conclusion

All existing themes and functionalities remain unaffected unless ShowEditMode is explicitly set to false.

tvatavuk added a commit to 2sic/cre8magic that referenced this issue Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants