-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add support for saving revisions of snippets #751
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #751 +/- ##
==========================================
- Coverage 92.60% 92.54% -0.06%
==========================================
Files 46 47 +1
Lines 4017 4092 +75
Branches 598 608 +10
==========================================
+ Hits 3720 3787 +67
- Misses 175 178 +3
- Partials 122 127 +5 ☔ View full report in Codecov by Sentry. |
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.
Hey @mcmeeking,
This is a great start! I think making TestSnippet
inherit from DraftStateMixin
was a good idea. Made a suggestion to improve the "no draft" model, though.
We need a few tests with drafts / revisions for the test snippet, so as to cover the new logic paths.
And finally, https://www.wagtail-localize.org/how-to/installation/#disabling-default-publication-of-translated-pages could use an update as that is no longer entirely true
@zerolab - I've just taken this for a test drive today and it's not right yet, the snippet edit view isn't rendering correctly. This is just an FYI not to merge this until further changes have been pushed. |
I'm pretty sure this is actually fine, I'm just not sure how to build the JS components when including my fork as a requirements.txt target, so the React components aren't loading on the edit page because |
you can run |
@mcmeeking the changes so far look quite good. However the translation editing interface doesn't pick up the drafts. You can test this locally by:
|
Thanks for this, I'll try and take a look and sort this week 👍 |
I will do some more tests tomorrow too (and compare with the page functionality) |
Having compared to what happens with pages, I think this does what it says on the tin. |
Sorry, took a little longer to get around to this than expected - I've taken it for another test drive yesterday following the steps suggested and it appears to be saving draft and allowing publish fine - but I think I see what you're referring to about the UI in that the status in the side panel still states "Live" even when there are new drafts. From my checks, this seems to be consistent with the Page translation edit page too.
|
Merged in 2773147 (with the removal of the 4.2 conditional Thank you |
I'm working on a project which has a need for setting new snippet translations as drafts by default, so I wanted to close #666.
Changes:
page_revision
field inTranslationLog
model is now simplyrevision
.WAGTAILLOCALIZE_SYNC_LIVE_STATUS_ON_TRANSLATE = False
when creating/updating translations for aDraftStateMixin
model is to save as a draft.DraftStateMixin
models publishes the revision in the same way as publishing a translatedPage
model (usingsave_target()
rather than just copying the segments).