-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support Wagtail 6 + add sharing link to Action Menu #3
Open
stevejalim
wants to merge
39
commits into
torchbox:main
Choose a base branch
from
mozmeao:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit mirrors the current functionality for Wagtail 5 in Wagtail 6 by creating a Stimulus JS controller and hooking it into Wagtail in a similar way as for Wagtail 5. For the page history view, the HTML templating is different, so the previous approach overrode wagtailadmin/pages/revisions/_actions.html to slot in custom markup that the JS could hook into. For Wagtail 6 we do something similar, extending wagtailadmin/generic/history/action_cell.html to slot in a bit of custom markup. For snippet-list view, we update the HTML output for the share_url method to hook in the Stimulus controller used above. The JS in the Stimulus controller is deliberately very similar to the original JS. I wondered about refactoring out the main duplicated code (the main function which triggers the creation of new links via a POST to the backend, and the function which upgrades the View button on the list view of existing sharing links to be a clipboard link). However, for now - and with a view potentially to deprecating pre-Wagtail 6 behaviour - I've gone with some repetition rather than DRY code. Note that we don't load both JS files into the browser - we only load the appropriate one based on the version of Wagtail in use
...if there is an unpublished draft that can be shared
…uring link creation
Bit of a nitpick here, I know - sorry!
incl datetime_now -> timezone_now to avoid mis-assumption about which library it's from
Brings coverage up to 98%, and effectively all code that needs coverage
…was coming back as a naive datetime So we patch it in the tests and warn about it
Note the tolerance of a should-not-build version python3.12-django3.2-wagtail6.1 - may be there are better ways around that
No need to have three things going when ruff does the lot
… expiry timestamps Note the addition to the README, requiring the use of settings.USE_TZ=True
Add Wagtail 6 support + extra way to create a sharing link
…as a maintainer contact
Hotfix: page creation was broken by addition to Action Menu 🤦
KIRA009
reviewed
Oct 26, 2024
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.
Hi @stevejalim I have just one outstanding question regarding the naming of the settings. Thanks for all the hard work, the tests are really thorough
Amend settings naming and update docs
…t more reusable from Python
…ython-api Move the link generation out of the view, to make it more reusable from Python
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is based on our fork of the project and I'm very happy to offer our changes back upstream.
The changeset:
For more details, please see the PR on our side: mozmeao#1
Note that this hasn't been tested in production yet, so feel free to wait a few weeks before merging. Equally, if during review you spot something that could be done better, please feel free to mention it!