From 9d40ca1c79b89cc05a84bf7a899e54f11543f5e1 Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Fri, 19 Apr 2024 06:44:41 +0700 Subject: [PATCH 1/2] Fix icon alignment in page listings --- client/scss/components/_listing.scss | 6 +----- .../pages/listing/_page_title_explore.html | 4 ++-- wagtail/admin/tests/pages/test_explorer_view.py | 10 ++++++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/client/scss/components/_listing.scss b/client/scss/components/_listing.scss index 1d1983e3c6..7323657ab8 100644 --- a/client/scss/components/_listing.scss +++ b/client/scss/components/_listing.scss @@ -231,6 +231,7 @@ ul.listing { gap: theme('spacing.2'); margin: 0; vertical-align: middle; + align-items: center; a { color: inherit; @@ -242,11 +243,6 @@ ul.listing { } } } - - .icon-folder { - margin: 3px 0.3em 0 0; - vertical-align: top; - } } .actions { diff --git a/wagtail/admin/templates/wagtailadmin/pages/listing/_page_title_explore.html b/wagtail/admin/templates/wagtailadmin/pages/listing/_page_title_explore.html index 755abd8539..5173c638ec 100644 --- a/wagtail/admin/templates/wagtailadmin/pages/listing/_page_title_explore.html +++ b/wagtail/admin/templates/wagtailadmin/pages/listing/_page_title_explore.html @@ -5,7 +5,7 @@
{% if page.is_site_root %} {% if perms.wagtailcore.add_site or perms.wagtailcore.change_site or perms.wagtailcore.delete_site %} - {% icon name="site" classname="initial" %} + {% icon name="site" classname="initial" %} {% endif %} {% endif %} @@ -17,7 +17,7 @@ without also reading out the buttons and indicators. {% endcomment %} {% fragment as page_title %} - + {% if not page.is_site_root and not page.is_leaf %}{% icon name="folder" classname="initial" %}{% endif %} {{ page.get_admin_display_title }} diff --git a/wagtail/admin/tests/pages/test_explorer_view.py b/wagtail/admin/tests/pages/test_explorer_view.py index 1c8689439a..b4a1c322ab 100644 --- a/wagtail/admin/tests/pages/test_explorer_view.py +++ b/wagtail/admin/tests/pages/test_explorer_view.py @@ -133,13 +133,15 @@ class TestPageExplorer(WagtailTestUtils, TestCase): def test_explore_root_shows_icon(self): response = self.client.get(reverse("wagtailadmin_explore_root")) self.assertEqual(response.status_code, 200) + soup = self.get_soup(response.content) # Administrator (or user with add_site permission) should see the # sites link with its icon - self.assertContains( - response, - ' Date: Fri, 19 Apr 2024 21:10:23 +0700 Subject: [PATCH 2/2] Remove --inline-actions variant of listing tables This was added in f322e9d8680530cc9668708a2ad06c2e8e7d7748, when the snippets listing view was briefly redesigned to put the "Edit", "Delete" etc. actions in the same line as the title instead of in a new line. With the universal listings design, all listing actions are put inside a three-dot dropdown menu. This style is no longer used anywhere in Wagtail, especially now that the HistoryView has been reimplemented using the dropdown menu for the actions. --- client/scss/components/_listing.scss | 34 +++---------------------- client/scss/components/_status-tag.scss | 1 + wagtail/admin/ui/tables/__init__.py | 4 --- wagtail/admin/views/generic/history.py | 3 +-- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/client/scss/components/_listing.scss b/client/scss/components/_listing.scss index 7323657ab8..a0733d3f34 100644 --- a/client/scss/components/_listing.scss +++ b/client/scss/components/_listing.scss @@ -223,6 +223,10 @@ ul.listing { .title { word-break: break-word; + display: flex; + align-items: center; + justify-content: space-between; + gap: theme('spacing.2'); .title-wrapper, h2 { @@ -261,36 +265,6 @@ ul.listing { } } - &--inline-actions td.title { - display: flex; - align-items: center; - justify-content: space-between; - flex-wrap: wrap; - gap: 0.5rem; - - .title-wrapper { - margin-inline-end: 2.5em; - } - - .w-status { - margin: 0; - } - } - - &--inline-actions .actions { - display: inline-block; - margin-top: 0; - vertical-align: inherit; - - li { - margin-bottom: 0; - } - - .button { - vertical-align: inherit; - } - } - .moderate-actions form { float: inline-start; margin: 0 1em 1em 0; diff --git a/client/scss/components/_status-tag.scss b/client/scss/components/_status-tag.scss index 456b8cbc9d..9956bf30a4 100644 --- a/client/scss/components/_status-tag.scss +++ b/client/scss/components/_status-tag.scss @@ -4,6 +4,7 @@ border-radius: 2px; text-align: center; display: inline-block; + flex-shrink: 0; // stylelint-disable-next-line property-disallowed-list text-transform: uppercase; padding: 0 0.5em; diff --git a/wagtail/admin/ui/tables/__init__.py b/wagtail/admin/ui/tables/__init__.py index 474f9d7c1b..23b68ae25f 100644 --- a/wagtail/admin/ui/tables/__init__.py +++ b/wagtail/admin/ui/tables/__init__.py @@ -518,7 +518,3 @@ class Table(Component): @cached_property def attrs(self): return self.table.get_row_attrs(self.instance) - - -class InlineActionsTable(Table): - classname = "listing listing--inline-actions" diff --git a/wagtail/admin/views/generic/history.py b/wagtail/admin/views/generic/history.py index c2d105f464..5227b7d08b 100644 --- a/wagtail/admin/views/generic/history.py +++ b/wagtail/admin/views/generic/history.py @@ -16,7 +16,7 @@ from wagtail.admin.filters import ( MultipleUserFilter, WagtailFilterSet, ) -from wagtail.admin.ui.tables import Column, DateColumn, InlineActionsTable, UserColumn +from wagtail.admin.ui.tables import Column, DateColumn, UserColumn from wagtail.admin.utils import get_latest_str from wagtail.admin.views.generic.base import ( BaseListingView, @@ -197,7 +197,6 @@ class HistoryView(PermissionCheckedMixin, BaseObjectMixin, BaseListingView): is_searchable = False paginate_by = 20 filterset_class = HistoryFilterSet - table_class = InlineActionsTable history_url_name = None history_results_url_name = None edit_url_name = None