mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Force admin sidebar for all admins in admin_sidebar_enabled_groups and handle legacy "hamburger dropdown" in this mode (#26899)
Some sites are still on the legacy "hamburger dropdown" navigation_menu setting. In this case to avoid confusion, we want to show both the sidebar icon and the header dropdown hamburger when visiting the admin portal. Otherwise, the hamburger switches sides from right to left for admins and takes on different behaviour. The hamburger in this case _only_ shows the main panel, not other sidebar panels like the admin one.
This commit is contained in:
@@ -6,10 +6,41 @@ module PageObjects
|
||||
class HeaderDropdown < Base
|
||||
def open
|
||||
find(".header-dropdown-toggle.hamburger-dropdown").click
|
||||
expect(page).to have_css(".sidebar-hamburger-dropdown")
|
||||
self
|
||||
end
|
||||
|
||||
def close
|
||||
open
|
||||
end
|
||||
|
||||
def has_sidebar_panel?(panel)
|
||||
has_css?(
|
||||
".sidebar-hamburger-dropdown .sidebar-section-wrapper[data-section-name=\"#{panel_id(panel)}\"]",
|
||||
)
|
||||
end
|
||||
|
||||
def has_no_sidebar_panel?(panel)
|
||||
has_no_css?(
|
||||
".sidebar-hamburger-dropdown .sidebar-section-wrapper[data-section-name=\"#{panel_id(panel)}\"]",
|
||||
)
|
||||
end
|
||||
|
||||
def has_dropdown_visible?
|
||||
page.has_css?(".sidebar-hamburger-dropdown")
|
||||
end
|
||||
|
||||
def has_no_dropdown_visible?
|
||||
page.has_no_css?(".sidebar-hamburger-dropdown")
|
||||
end
|
||||
|
||||
def visible?
|
||||
page.has_css?(".hamburger-dropdown.header-dropdown-toggle")
|
||||
end
|
||||
|
||||
def not_visible?
|
||||
page.has_no_css?(".hamburger-dropdown.header-dropdown-toggle")
|
||||
end
|
||||
|
||||
def click_customize_community_section_button
|
||||
community_section.click_button(
|
||||
I18n.t("js.sidebar.sections.community.edit_section.header_dropdown"),
|
||||
@@ -19,6 +50,16 @@ module PageObjects
|
||||
|
||||
PageObjects::Modals::SidebarSectionForm.new
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def panel_id(panel)
|
||||
if panel == "admin"
|
||||
"admin-root"
|
||||
elsif panel == "main"
|
||||
"community"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,6 +9,14 @@ module PageObjects
|
||||
wait_for_animation(find("div.menu-panel"))
|
||||
end
|
||||
|
||||
def click_header_toggle
|
||||
find(header_toggle_css).click
|
||||
end
|
||||
|
||||
def header_toggle_css
|
||||
".header-sidebar-toggle"
|
||||
end
|
||||
|
||||
def visible?
|
||||
page.has_css?("#d-sidebar")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user