Admin panel
This section is only relevant for Spree 4
Starting with Spree 4.7, we’ve introduced a new way of customizing the admin panel, that enables extensions to modify the admin panel UI without depending on the Deface gem. For Spree 4.6 and earlier, please see how to use deface_overrides_tutorial.md overrides.
Customizing the main menu
When extending Spree with custom features, it’s common to add new options to the menu on the left-hand side.
The menu is built with Spree::Admin::MainMenu::Section
and Spree::Admin::MainMenu::Item
objects.
Additionally, there are two builder classes Spree::Admin::MainMenu::SectionBuilder
and Spree::Admin::MainMenu::ItemBuilder
that make it easier to build more complex sections.
The menu is available under Rails.application.config.spree_backend.main_menu
and can be modified by both extensions as well as the Rails application code.
Example: adding an additional section to the admin panel:
For a more extensive example, take a look at how the default menu is built.
Customizing tabs
In some cases you may need to add a new tab to a page for editing Orders, Products or Users.

These tabs are built with Spree::Admin::Tabs::Tab
. You can also use Spree::Admin::Tabs::TabBuilder
class to construct new Tab objects. The tabs are attached to Rails.application.config.spree_backend.tabs
and can be modified via an initializer.
Example: adding an additional tab to the product edit admin page
Customizing actions
A common case for extensions is to add a new action button in the admin panel.
Action buttons are built with Spree::Admin::Actions::Action
or with a dedicated Spree::Admin::Actions::ActionBuilder
class. The action buttons are attached to Rails.application.config.spree_backend.actions
and can be modified with an initializer.
Example: adding a new button to the order page
Customizing existing views and partials
If you need a more extensive customization of any of the admin panel pages, you can just copy their .erb file from the spree_backend
gem to your app/views/
directory and modify it there. This allows you to fully override default views provided by the spree_backend
gem.
Note: This approach is not recommended for Spree extensions, as it may conflict with other extensions that modify the same view.
Was this page helpful?