diff --git a/CHANGELOG.txt b/CHANGELOG.txt index b521553a7f..7ff31da33e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -23,6 +23,7 @@ Changelog * Fix: Ensure comment buttons always respect `WAGTAILADMIN_COMMENTS_ENABLED` (Thibaud Colas) * Fix: Fix error when deleting a single snippet through the bulk actions interface (Sage Abdullah) * Fix: Pass the correct `for_update` value for `get_form_class` in `SnippetViewSet` edit views (Sage Abdullah) + * Fix: Move comment notifications toggle to the comments side panel (Sage Abdullah) * Docs: Update documentation for `log_action` parameter on `RevisionMixin.save_revision` (Christer Jensen) diff --git a/client/src/entrypoints/admin/comments.js b/client/src/entrypoints/admin/comments.js index a8b47a30ed..fb0bcf2ac6 100644 --- a/client/src/entrypoints/admin/comments.js +++ b/client/src/entrypoints/admin/comments.js @@ -289,10 +289,15 @@ window.comments = (() => { } // Show comments app - const commentNotifications = formElement.querySelector( + const commentNotifications = document.querySelector( '[data-comment-notifications]', ); commentNotifications.hidden = false; + // Attach the comment notifications input to the form using the form attribute + // because the input element is outside the form. + const notificationsInput = commentNotifications.querySelector('input'); + notificationsInput.setAttribute('form', formElement.id); + const tabContentElement = formElement.querySelector('.tab-content'); tabContentElement.classList.add('tab-content--comments-enabled'); diff --git a/docs/releases/5.0.1.md b/docs/releases/5.0.1.md index 5ca050acf1..25e3390bad 100644 --- a/docs/releases/5.0.1.md +++ b/docs/releases/5.0.1.md @@ -18,6 +18,7 @@ depth: 1 * Ensure comment buttons always respect `WAGTAILADMIN_COMMENTS_ENABLED` (Thibaud Colas) * Fix error when deleting a single snippet through the bulk actions interface (Sage Abdullah) * Pass the correct `for_update` value for `get_form_class` in `SnippetViewSet` edit views (Sage Abdullah) + * Move comment notifications toggle to the comments side panel (Sage Abdullah) ### Documentation diff --git a/wagtail/admin/templates/wagtailadmin/panels/tabbed_interface.html b/wagtail/admin/templates/wagtailadmin/panels/tabbed_interface.html index 3531f80933..c9655a5766 100644 --- a/wagtail/admin/templates/wagtailadmin/panels/tabbed_interface.html +++ b/wagtail/admin/templates/wagtailadmin/panels/tabbed_interface.html @@ -14,17 +14,6 @@ {% endif %} {% endfor %} - - {# Comment Notifications Toggle #} - {% if self.form.show_comments_toggle %} - - {% endif %}
diff --git a/wagtail/admin/templates/wagtailadmin/shared/side_panels/comments.html b/wagtail/admin/templates/wagtailadmin/shared/side_panels/comments.html index 034e080f9a..b68dbd81ab 100644 --- a/wagtail/admin/templates/wagtailadmin/shared/side_panels/comments.html +++ b/wagtail/admin/templates/wagtailadmin/shared/side_panels/comments.html @@ -1 +1,14 @@ +{% load i18n %} + +{# Comment Notifications Toggle #} +{% if form.show_comments_toggle %} + +{% endif %} +
diff --git a/wagtail/admin/ui/side_panels.py b/wagtail/admin/ui/side_panels.py index 51a6177258..f5ae4f1131 100644 --- a/wagtail/admin/ui/side_panels.py +++ b/wagtail/admin/ui/side_panels.py @@ -282,6 +282,11 @@ class CommentsSidePanel(BaseSidePanel): toggle_aria_label = gettext_lazy("Toggle comments") toggle_icon_name = "comment" + def get_context_data(self, parent_context): + context = super().get_context_data(parent_context) + context["form"] = parent_context.get("form") + return context + class BasePreviewSidePanel(BaseSidePanel): name = "preview"