Skip to content

Upgrading Admin Navigation to 1.2

Kevin Attfield edited this page Nov 27, 2015 · 3 revisions

In 1.2 we moved the admin menu from the top of the page, to the left side of the page. We also added "flyout" behaviour to all subnav items. As such, all navigation items are now present on all pages. This has 2 main effects.

admin menu before and after

Updating Templates

_sub_menu.html.erb is gone and all subnav partials (e.g., _product_sub_menu.html.erb) are used in a single place _tabs.html.erb instead of being added to each relevant page individually.

  • Any changes you have made to top level nav items are probably fine.
  • Remove all of your <%= render 'spree/admin/shared/X_sub_menu' %>.
  • Add any submenu templates you have created to _tabs.html.erb.
  • Upgrade solidus_auth_devise

Fixing tests

With the concurrent change to Capybara's matching mode from :prefer_exact to :smart (see 1.2 changelog) tests which before relied on submenu items not being rendered on the page will fail. A new feature test helper click_nav(<primary nav item text>, <optional subnav item text>) has been added.

  • Replace primary nav clicks click_link("Orders") with click_nav("Orders").
  • Replace secondary nav clicks click_link("Taxonomies") with click_nav("Products", "Taxonomies").
  • Replace secondary nav selectors within('#sub-menu') with within('.selected .admin-subnav')