-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Adopt classname
instead of classnames
in all MenuItem/Sidebar usage
#10907
Conversation
Manage this branch in SquashTest this branch here: https://lb-cleanupadopt-classname-menu-9y7xb.squash.io |
366b084
to
dd73aa4
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.
Lotf of great stuff here, @lb- 👏🏼
Left a number of suggestions
41b88e4
to
fee562c
Compare
fee562c
to
d006beb
Compare
Thanks @zerolab - ready for another round if you have time. |
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.
This is so close. One minor suggestion.
Also 2 other points:
-
I know modeladmin is being deprecated, but it is worth updating it as well since
ModelAdminMenuItem
subclassesMenuItem
and passesclassnames
in__init__
- https://github.com/wagtail/wagtail/blob/main/wagtail/contrib/modeladmin/menus.py#L24 (also L52) -
One to address in a follow-up PR, I think -
images.formats.Format
that usesclassnames
as an arg
d006beb
to
05266a5
Compare
Thanks @zerolab fixed up now. Inc. modeladmin items. |
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.
I just realised that we don't have tests for the new RemovedInWagtail60Warning
We have a number of them for other areas -
https://github.com/search?q=repo%3Awagtail%2Fwagtail+RemovedInWagtail60Warning+path%3A%2Ftests\%2F%2F&type=code - and I am torn.
Other than this, LGTM. Epic tidy up
05266a5
to
b822f34
Compare
OK I have add some tests for the core |
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.
- Adds a deprecation path, including documentation to further remove unpredictable naming of adding `classname` in Python APIs - Intentionally keeps `classNames` in Telepath adaptor inner usage as this convention is not set, however, the server side value passed in will use `classname` - See https://docs.wagtail.org/en/stable/contributing/general_guidelines.html#use-classname-in-python-html-template-tag-variables - See wagtail#9769 & wagtail#9770
b822f34
to
a4c7613
Compare
Thanks @zerolab - I really appreciate the reviews. |
In Wagtail 4.2 we started being more consistent with how we support
classname
kwargs in various components and templates, this seemed to be received well and means our code is more predictable.At the time we avoided changing anything that was not yet fully documented or just had a small surface area. In this PR I propose we adjust one documented use case
MenuItem
(and related) with a clear deprecation path.I think this will make using Wagtail more intuitive for developers and sets us up for easier customisation in the long term.
Details
classname
in Python APIsclassNames
in Telepath adaptor inner usage as this convention is not set, however, the server side value passed in will useclassname
classname
instead ofclass_name
by default #9769 & Ensure all icon template tags useclassname
instead ofclass_name
& add deprecation warning #9770Checklist