This section is only relevant for Spree 4
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 withSpree::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:
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 withSpree::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 withSpree::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 thespree_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.