Skip to content

A platform for community discussion. Free, open, simple.

UX: Keep "Themes & Components" admin sidebar link active on components (#34869)

Alan Guo Xiang Tan4b3b5b2dff7f
diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js
index 6f066ed882f..79b99fa2156 100644
--- a/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js
+++ b/app/assets/javascripts/discourse/app/lib/sidebar/admin-nav-map.js
@@ -272,6 +272,8 @@ export const ADMIN_NAV_MAP = [
description: "admin.config.themes_and_components.header_description",
icon: "paintbrush",
keywords: "admin.config.themes_and_components.keywords",
+ currentWhen:
+ "adminConfig.customize.themes adminConfig.customize.components adminConfig.customize.themeSiteSettings",
links: [
{
name: "admin_theme_site_settings",
diff --git a/spec/system/admin_sidebar_navigation_spec.rb b/spec/system/admin_sidebar_navigation_spec.rb
index 86cbede3310..433e7a05dac 100644
--- a/spec/system/admin_sidebar_navigation_spec.rb
+++ b/spec/system/admin_sidebar_navigation_spec.rb
@@ -116,17 +116,25 @@ describe "Admin | Sidebar Navigation", type: :system do
)
end
- it "highlights the 'Themes and components' link when the themes page is visited" do
+ it "highlights the 'Themes and components' link when either the themes, themes components or theme site settings admin page is visited" do
visit("/admin/config/customize/themes")
+
expect(page).to have_css(
'.sidebar-section-link-wrapper[data-list-item-name="admin_themes_and_components"] a.active',
)
- end
- # TODO(osama) unskip this test when the "Themes and components" link is
- # changed to the new config customize page
- xit "highlights the 'Themes and components' link when the components page is visited" do
- visit("/admin/config/customize/components")
+ click_link("Components")
+
+ expect(page).to have_current_path("/admin/config/customize/components")
+
+ expect(page).to have_css(
+ '.sidebar-section-link-wrapper[data-list-item-name="admin_themes_and_components"] a.active',
+ )
+
+ click_link("Theme site settings")
+
+ expect(page).to have_current_path("/admin/config/customize/theme-site-settings")
+
expect(page).to have_css(
'.sidebar-section-link-wrapper[data-list-item-name="admin_themes_and_components"] a.active',
)