0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00

Add text ellipsis styles and shorten wording in title header search results label

This commit is contained in:
Thibaud Colas 2024-01-22 08:16:27 +00:00 committed by sag​e
parent 90ecdb4928
commit 57d75e2870
3 changed files with 24 additions and 4 deletions

View File

@ -678,3 +678,20 @@ table.listing {
color: theme('colors.text-link-default');
}
}
.w-title-ellipsis {
display: inline-block;
vertical-align: middle;
max-width: 20ch;
overflow-x: hidden;
text-overflow: ellipsis;
white-space: nowrap;
@include media-breakpoint-up(sm) {
max-width: 30ch;
}
@include media-breakpoint-up(md) {
max-width: none;
}
}

View File

@ -15,16 +15,16 @@
{% endblocktranslate %}
{% endif %}
<a href="{{ table.base_url }}{% querystring p=None search_all=None %}">
{% blocktranslate trimmed with title=parent_page.get_admin_display_title %}Search within '{{ title }}'{% endblocktranslate %}
{% blocktranslate trimmed with title=parent_page.get_admin_display_title %}Search in '<span class="w-title-ellipsis">{{ title }}</span>'{% endblocktranslate %}
</a>
{% else %}
{% if result_count %}
{% blocktranslate trimmed with title=parent_page.get_admin_display_title %}
{{ start_index }}-{{ end_index }} of {{ result_count }} within '{{ title }}'.
{{ start_index }}-{{ end_index }} of {{ result_count }} in '<span class="w-title-ellipsis">{{ title }}</span>'.
{% endblocktranslate %}
{% else %}
{% blocktranslate trimmed with title=parent_page.get_admin_display_title %}
No results within '{{ title }}'.
No results in '<span class="w-title-ellipsis">{{ title }}</span>'.
{% endblocktranslate %}
{% endif %}
<a href="{{ table.base_url }}{% querystring p=None search_all=1 %}">

View File

@ -559,7 +559,10 @@ class TestPageExplorer(WagtailTestUtils, TestCase):
self.assertEqual(response.status_code, 200)
page_ids = [page.id for page in response.context["pages"]]
self.assertEqual(page_ids, [self.old_page.id])
self.assertContains(response, "Search within 'New page (simple page)'")
self.assertContains(
response,
"Search in '<span class=\"w-title-ellipsis\">New page (simple page)</span>'",
)
def test_filter_by_page_type(self):
new_page_child = SimplePage(