Skip to content
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

feat: Support for conditional menu item rendering #1631

Merged
merged 4 commits into from
May 7, 2021
Merged

feat: Support for conditional menu item rendering #1631

merged 4 commits into from
May 7, 2021

Conversation

benjreinhart
Copy link
Contributor

Description

This is "part 2" of #1629. It adds support for conditionally rendering menu items at request time.

@dpgaspar the tests for the menu piece specifically are not very comprehensive but I think we should get more confidence around this code. Do you have a preference for how you'd like to expand upon these tests? The menu code is almost entirely self-contained, so IMO we should pass the one non-self-contained piece (current_app) which let's us easily stub that value and unit test the code. That should give us all we need, since this is already tested from API PoV. Thoughts?

Also, let me know what other (if any) docs you think should be added here.

Copy link
Owner

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, the API get's self documented

:param cond:
If a callable, :code:`cond` will be invoked when
constructing the menu items. If it returns :code:`True`,
then this link will part of the menu. Otherwise, it
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then this link will be part of the menu

@benjreinhart benjreinhart merged commit b60dea9 into dpgaspar:master May 7, 2021
@benjreinhart benjreinhart deleted the menus branch May 7, 2021 21:19
@benjreinhart benjreinhart mentioned this pull request May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants