-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup MenuItem
API and deprecate using partials for second level menus
#5309
Conversation
273f683
to
2cd1512
Compare
58ed5d3
to
423029d
Compare
Block handling in ERB is different than a regular method. Regular methods are interested in the return value, while for ERB we need to capture the ERB output produced by running the block and discard the return value. The `capture` method does just that.
ab47d60
to
f6e8e70
Compare
Codecov Report
@@ Coverage Diff @@
## main #5309 +/- ##
==========================================
+ Coverage 88.71% 88.76% +0.05%
==========================================
Files 563 564 +1
Lines 13896 13959 +63
==========================================
+ Hits 12328 12391 +63
Misses 1568 1568
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
f6e8e70
to
4903d35
Compare
MenuItems
apiMenuItems
generation
Also moves `#icon` from a sequential argument to a keyword argument. The list of sections was only used to match the current path, because top-level menu items should be active whenever any of the children items are active.
The first part will just setup options and the bottom of the method takes care of generating the "tab".
The menu item will now be able to tell if a request matches itself.
Use MenuItem instances for second level backend menus instead of partials.
The condition option was duplicating what the children were already checking.
3295e54
to
f8f801e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @elia! I appreciate the simplicity you've introduced, especially in creating new menu items without needing partial views. Thanks a lot!
f8f801e
to
b79954e
Compare
Rely on the implicit array ordering.
b79954e
to
78497dd
Compare
MenuItems
generationMenuItems
api and deprecate partials
MenuItems
api and deprecate partialsMenuItem
API and deprecate using partials for second level menus
Summary
Remove
#sections
that was probably introduced in order to generate the submenu and later became just a way to check if the MenuItem was "selected" or not.This paves the way for replacing the second level navigation partials with a list of children items.
The
tab
helper is also updated and uses explicitlabel:
andmatch_path:
options instead of the initial list of sections.MenuItem#position
replacementMenuItem#position
is deprecated and can be replaced by reordering menu items explicitly in the backend config:or
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: