Skip to content

Commit

Permalink
Deprecate the use of MenuItem#position
Browse files Browse the repository at this point in the history
Rely on the implicit array ordering.
  • Loading branch information
elia committed Sep 21, 2023
1 parent 6fb2c79 commit f6e8e70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/app/views/spree/admin/shared/_tabs.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% Spree::Backend::Config.menu_items.sort_by { |item| item.position || Float::INFINITY }.each do |menu_item| %>
<% Spree::Backend::Config.menu_items.each do |menu_item| %>
<% if menu_item.render_in?(self) %>
<%=
tab(
Expand Down
4 changes: 3 additions & 1 deletion backend/lib/spree/backend_configuration/menu_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ def sections # rubocop:disable Style/TrivialAccessors
end
deprecate sections: :label, deprecator: Spree::Deprecation

attr_accessor :position
attr_accessor :position # rubocop:disable Layout/EmptyLinesAroundAttributeAccessor
deprecate position: nil, deprecator: Spree::Deprecation
deprecate "position=": nil, deprecator: Spree::Deprecation

# @param icon [String] The icon to draw for this menu item
# @param condition [Proc] A proc which returns true if this menu item
Expand Down

0 comments on commit f6e8e70

Please sign in to comment.