-
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
Convert to alias #515
Convert to alias #515
Conversation
Only applies to translated pages
a8c9161
to
25ffc81
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.
This looks really good! Just some minor tweaks and a couple of questions
wagtail_localize/templates/wagtail_localize/admin/confirm_convert_to_alias.html
Outdated
Show resolved
Hide resolved
wagtail_localize/views/convert.py
Outdated
next_url = get_valid_next_url_from_request(request) | ||
|
||
if request.method == "POST": | ||
page.alias_of_id = source_page_id |
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.
Should we synchronise the content of the source page at this point?
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.
probably worth it, will check
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.
The consensus is that ye, we should synchronise with the source page at this point
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.
tl;dr
Tried with Translation.save_target()
but that is very much dependent on the translatable_fields
definition or lack thereof.
Resorted to a tweaked copy of Page.update_alias
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, do you think we could get those tweaks rolled back in to Wagtail core?
I'm happy with this change anyhow
Codecov Report
@@ Coverage Diff @@
## main #515 +/- ##
==========================================
- Coverage 91.72% 91.56% -0.17%
==========================================
Files 36 37 +1
Lines 3081 3200 +119
Branches 494 513 +19
==========================================
+ Hits 2826 2930 +104
- Misses 145 154 +9
- Partials 110 116 +6
Continue to review full report at Codecov.
|
7d97ecd
to
ae28a5b
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.
Looks good to me, thanks!
This PR fixes #466 by adding functionality to convert translations (translated pages, to be more exact) into aliases
It also adds a
wagtail_localize.convert_to_alias
PageLogEntry action, and its own icon.Demo: https://youtu.be/N6iVvq4sqjU