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

Convert to alias #515

Merged
merged 10 commits into from
Feb 17, 2022
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,23 @@ const EditorFooter: FunctionComponent<EditorProps> = ({
if (links.convertToAliasUrl) {
actions.push(
<form method="GET" action={links.convertToAliasUrl}>
<input type="hidden" name="csrfmiddlewaretoken" value={csrfToken}/>
<input type="hidden" name="next" value={window.location.href}/>
<input
type="hidden"
name="csrfmiddlewaretoken"
value={csrfToken}
/>
zerolab marked this conversation as resolved.
Show resolved Hide resolved
<input type="hidden" name="next" value={window.location.href} />

<button
type="submit"
className="button action-secondary"
aria-label={gettext('Convert to alias page')}
>
<Icon name="undo"/>
<Icon name="wagtail-localize-convert" />
{gettext('Convert to alias page')}
</button>
</form>
)
);
}

if (perms.canDelete) {
Expand Down
2 changes: 2 additions & 0 deletions wagtail_localize/templates/wagtail_localize/icons/convert.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion wagtail_localize/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def register_restart_translation_page_action_menu_item():
class ConvertToAliasPageActionMenuItem(PageActionMenuItem):
label = gettext_lazy("Convert to alias page")
name = "localize-convert-to-alias"
icon_name = "undo"
icon_name = "wagtail-localize-convert"
classname = "action-secondary"

def _is_shown(self, context):
Expand Down Expand Up @@ -434,3 +434,9 @@ def format_message(self, log_entry):
}
except KeyError:
return _("Converted page to an alias of the translation source page")


@hooks.register("register_icons")
def register_icons(icons):
# icon id "wagtail-localize-convert" (which translates to `.icon-wagtail-localize-convert`)
return icons + ["wagtail_localize/icons/convert.svg"]