Skip to content

Commit

Permalink
Fix icon alignment in page listings
Browse files Browse the repository at this point in the history
  • Loading branch information
laymonage committed Apr 19, 2024
1 parent 2174cf4 commit 9d40ca1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 1 addition & 5 deletions client/scss/components/_listing.scss
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ ul.listing {
gap: theme('spacing.2');
margin: 0;
vertical-align: middle;
align-items: center;

a {
color: inherit;
Expand All @@ -242,11 +243,6 @@ ul.listing {
}
}
}

.icon-folder {
margin: 3px 0.3em 0 0;
vertical-align: top;
}
}

.actions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="title-wrapper">
{% if page.is_site_root %}
{% if perms.wagtailcore.add_site or perms.wagtailcore.change_site or perms.wagtailcore.delete_site %}
<a href="{% url 'wagtailsites:index' %}" title="{% trans 'Sites menu' %}">{% icon name="site" classname="initial" %}</a>
<a href="{% url 'wagtailsites:index' %}" title="{% trans 'Sites menu' %}" class="w-flex w-items-center">{% icon name="site" classname="initial" %}</a>
{% endif %}
{% endif %}

Expand All @@ -17,7 +17,7 @@
without also reading out the buttons and indicators.
{% endcomment %}
{% fragment as page_title %}
<span id="page_{{ page.pk|unlocalize|admin_urlquote }}_title">
<span id="page_{{ page.pk|unlocalize|admin_urlquote }}_title" class="w-flex w-items-center w-gap-2">
{% if not page.is_site_root and not page.is_leaf %}{% icon name="folder" classname="initial" %}{% endif %}
{{ page.get_admin_display_title }}
</span>
Expand Down
10 changes: 6 additions & 4 deletions wagtail/admin/tests/pages/test_explorer_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,15 @@ def test_explore_root(self):
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,
'<a href="/admin/sites/" title="Sites menu"><svg',
)
url = reverse("wagtailsites:index")
link = soup.select_one(f'td a[href="{url}"]')
self.assertIsNotNone(link)
icon = link.select_one("svg use[href='#icon-site']")
self.assertIsNotNone(icon)

def test_ordering(self):
response = self.client.get(
Expand Down

0 comments on commit 9d40ca1

Please sign in to comment.