Skip to content

Commit

Permalink
Merge branch 'snipet_viewset_patching'
Browse files Browse the repository at this point in the history
  • Loading branch information
Diogo Marques committed Apr 4, 2024
2 parents 02302df + 76f4204 commit de19df6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions wagtail_modeltranslation/patch_wagtailadmin.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ def _patch_other_models(self, model):
tab.children = self._patch_panels(tab.children)
elif hasattr(model, "panels"):
model.panels = self._patch_panels(model.panels)
elif hasattr(model, "snippet_viewset"):
edit_handler = model.snippet_viewset.get_edit_handler()
for tab in edit_handler.children:
tab.children = self._patch_panels(tab.children)
model.snippet_viewset.edit_handler = edit_handler.bind_to_model(model)
else:
panels = extract_panel_definitions_from_model_class(model)
translation_registered_fields = translator.get_options_for_model(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jQuery( () => {
///////////////

const tabbedContent = $(`form .tab-content, form .nice-padding`);
const topLevel = (tabbedContent.length > 0) ? tabbedContent.first() : $(`.content > form`);
const topLevel = (tabbedContent.length > 0) ? tabbedContent.first() : $(`.content form`);
const languageCodeRegex = new RegExp(' \\[('+wagtailModelTranslations.languages.join('|')+')\\]');

if (topLevel.length === 0) {
Expand Down

0 comments on commit de19df6

Please sign in to comment.