Solidus v4.1 (2023-06-29)
Minimal requirements:
- v3.0
- v7.0
Solidus v4.1 is out! 🎉
This release is relatively tiny and should be quite easy to upgrade. It starts to lay down the foundational work for the new Admin, which will be delivered gradually during the rest of the v4.x releases.
In fact, with v4.1, stores can switch their Admin to the new color scheme, and allow operators to start getting used to it, reducing the impact of future changes.
Let's see in detail the main things to be aware of when upgrading.
Please, when upgrading, remember to review our generic upgrade guides and run:
bin/rails g solidus:update
You can also check the complete Changelog in our repository.
Add a new admin theme
https://github.com/solidusio/solidus/pull/5092 is the first step towards the new Admin. It introduces a new theme, which is a set of colors and styles that can be applied to the Admin.
To switch to the new theme, you can set the following preference:
Spree::Backend::Config.theme = 'solidus_admin'
Allow changing the order recalculator
The order.recalculate
and order.recalculator
are introduced as aliases to the now deprecated
order.update
and order.updater
in order to clarify the intention of these methods.
This change also adds a preference to change the order recalculator (also known as order updater). If your store has any customization of the order recalculator, you can evaluate creating your own class that inherits from the current OrderUpdater class and set the new preference as:
Spree::Config.order_recalculator_class = 'YourCustomOrderRecalucator'
Remove respond_to :html from Spree::BaseController
When we removed the gem responders
as a core dependency (it still is for backend and api),
we forgot to move the respond_to :html
statement from Spree::BaseController
, which is part
of core.
This change cleans up this discrepancy, but when updating please be aware that your custom code could be broken if these statements are true together:
- You have a controller inheriting from Spree::BaseController.
- You are making use of responders in that controller.
- You are also using the
:html
format. - And you are not explicitly adding the
:html
format.
If that's the case, you can just add respond_to :html
in that controller to fix it.
Allow lambda in menu item :match_path option and URL
This change allows setting a path for a menu item via a lambda executed at runtime. If engines other than Solidus
would like their route in the main menu, this is how they can do it dynamically without having to hard-code the path.
Similarly, we allow the match_path
option for Menu Items to be a callable taking a request.
You can now do:
Spree::Backend::Config.configure do |config|
config.menu_items << config.class::MenuItem.new(
[:admin, :my_custom_controller],
'my_custom_controller',
url: ->(_request) { # do something to generate the menu item's URL },
match_path: ->(_request) { # do something to match the path and highlight the menu item }
)
end
If you have any customization for setting complex path
s and match_path
s in your Admin menu items,
it's time to remove them and switch to this method.