-
Notifications
You must be signed in to change notification settings - Fork 0
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
Main Menu Template Tags #85
Conversation
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.
LGTM - works as expected
The base branch was changed.
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.
Thanks @sanjeevz3009 I have functionally tested and it works well. Added one query to the template.
…navigation_template_tags added and navigation_tags refactored.
* Front-end hacked together to complete the back-end * Navigation app added, models created for navigation settings * Navigation bar on the front-end test * Front-end code reverted due to the front-end main menu being done separately * New line * Code formatted * Type hinted and code formatted * Code refactored, abstract link class created, validation messages added, section restricted to 3, URL label added, icon for navigation settings added and restricting it to so only 1 main menu can be created * Migration file * Main menu modelling complete, restricting user to be able to only create one main menu instance in the wagtail admin. Migration file added. * LinkBlock extracted out of core.blocks.related and moved to core.blocks.base to be reusable across the project. LinkBlock from core.blocks.base is being used instead of the abstract class originally defined in models.py. * Code formatted, zombie code removed, unused imports removed and MainMenuViewSet added to restrict creating more than one main menu instance * Front-end integrated * Type hints added * Nav template issues fixed * gettext_lazy added * Preview added * Use the title provided by the user over the default title from the page * help text update * Type hints added * Migration file regenerated * Tests added * TODO removed and translatable added * Description help text updated * Tests setup * Example StreamField value setting in test_highlights_streamfield_limit * Debug * Errors being raised when adding more than 3 highlights * Committing working factories to save * Clean method for ColumnBlock added and tests updated * Updated tests * test_section_streamfield_limit test working * Added more tests, factories updated * Removed tests * Max num code removed * Code formatted * Utilising pageurl to point to get internal wagtail pages * Code refactored * Reverting format for md files * Reverting md files formatting * Lint errors corrected * Unused import removed and base template updated * Base template update * Type checking added back in * Template code updated to make sure to only display live wagtail pages * Main menu live preview fixed * MegaLinter errors fixed * Using a preview template for live previews * Mark NavigationSettings as allowed for write in ExternalEnvRouter * Use our own BaseSiteSetting which works with the ExternalEnvRouter * RevisionMixin implementation and mypy fix * Blocks refactor * Code linted * Tests for main menu viewset added * Type ignore added * Duplicate page and external URL validation for sections and topic links within columns complete. * Duplicate page and URL for columns complete. * test_forms in place * Update test_clean_highlights_no_duplicate test * Tests complete for forms.py * test_forms.py code clean up * Example usage zombie code removed * Code formatted and refactored * Code refactored, type hinted, tests refactored. * gettext translation added * LinkBlock Factory moved * De-nest the blocks tests folder
…ion doc strings updated and unused code in navigation_tags file removed.
6f19227
to
f17986e
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.
Some nits, but otherwise this looks great!
What is the context of this PR?
This is a follow-up PR to the #41.
This PR introduces template tags for the main menu, by removing front-end logic. By separating concerns, this ensures templates are focused on presentation while business logic remains in Python. This improves readability and testability, simplifying the template structure. Additionally, we will have a more maintainable code by reducing complexity and allowing for performance optimisations when the page is rendered.
How to review
Test the main menu per norm as instructed in #41 description. Everything should work normally when adding a main menu -> highlights -> columns - > sections -> topics.
Follow-up Actions
List any follow-up actions (if applicable), like needed documentation updates or additional testing.