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

Remove nice-padding from documents, users, and generic listing views tables

The added CSS handles the case when nice padding is removed (to make the listing
go full-width) and no bulk actions are available (e.g. a ModelViewSet index view
or some other view that extends generic listing view).

This allows us to not rely on the full-width class (which should
eventually be removed) while correctly apply the spacing regardless
whether nice-padding is used or not, and whether bulk actions are
available or not.

If nice-padding is used, then the listing view will look as they
previously do.
This commit is contained in:
Sage Abdullah 2023-12-15 18:51:18 +00:00 committed by Thibaud Colas
parent 1ad22f530d
commit 81ea6d6266
7 changed files with 35 additions and 26 deletions

View File

@ -620,6 +620,15 @@ table.listing {
}
}
// If no bulk actions are present, and nice padding is not applied,
// apply the same 80px padding via the first column's left padding.
&:not(.nice-padding &):not(:has(.bulk-action-checkbox)) {
th:first-child,
td:first-child {
padding-inline-start: theme('spacing.20');
}
}
&.full-width .divider td {
padding-inline-start: 50px;
}

View File

@ -22,7 +22,7 @@
{% endblock %}
{% block listing %}
<div class="nice-padding{% if filters and not breadcrumbs_items %} filterable{% endif %}">
<div class="{% if filters and not breadcrumbs_items %} filterable{% endif %}">
<div id="listing-results">
{% if breadcrumbs_items and locale %}
{# TODO: temporarily put the locale selector here since we no longer use the legacy header #}

View File

@ -2,18 +2,20 @@
{% load i18n wagtailadmin_tags %}
{% block before_results %}
{% if is_searching or is_filtering %}
<h2 role="alert">
{% blocktrans trimmed count counter=items_count %}
There is {{ counter }} match
{% plural %}
There are {{ counter }} matches
{% endblocktrans %}
</h2>
{% endif %}
{% if is_searching and view.show_other_searches %}
{% search_other %}
{% endif %}
<div class="nice-padding">
{% if is_searching or is_filtering %}
<h2 role="alert">
{% blocktrans trimmed count counter=items_count %}
There is {{ counter }} match
{% plural %}
There are {{ counter }} matches
{% endblocktrans %}
</h2>
{% endif %}
{% if is_searching and view.show_other_searches %}
{% search_other %}
{% endif %}
</div>
{% endblock %}
{% block no_results_message %}

View File

@ -13,10 +13,8 @@
{% endblock %}
{% block listing %}
<div class="nice-padding">
<div id="listing-results">
{% include view.results_template_name|default:"wagtailadmin/generic/listing_results.html" %}
</div>
<div id="listing-results">
{% include view.results_template_name|default:"wagtailadmin/generic/listing_results.html" %}
</div>
{% endblock %}

View File

@ -11,5 +11,7 @@
{% endif %}
{% endblock %}
{% else %}
{% block no_results_message %}<p>{% trans "There are no results." %}</p>{% endblock %}
<div class="nice-padding w-mt-8">
{% block no_results_message %}<p>{% trans "There are no results." %}</p>{% endblock %}
</div>
{% endif %}

View File

@ -10,9 +10,9 @@
{% endblock %}
{% block listing %}
<div class="nice-padding">
<div>
{% if collections %}
<form action="{{ index_url }}" method="GET" novalidate>
<form class="nice-padding" action="{{ index_url }}" method="GET" novalidate>
<ul class="fields">
<li>{% include "wagtailadmin/shared/collection_chooser.html" %}</li>
</ul>

View File

@ -9,11 +9,9 @@
{% endblock %}
{% block listing %}
<div class="nice-padding">
<div id="listing-results" class="users">
{% include "wagtailusers/users/results.html" %}
</div>
{% trans "Select all users in listing" as select_all_text %}
{% include 'wagtailadmin/bulk_actions/footer.html' with select_all_obj_text=select_all_text app_label=app_label model_name=model_name objects=page_obj %}
<div id="listing-results" class="users">
{% include "wagtailusers/users/results.html" %}
</div>
{% trans "Select all users in listing" as select_all_text %}
{% include 'wagtailadmin/bulk_actions/footer.html' with select_all_obj_text=select_all_text app_label=app_label model_name=model_name objects=page_obj %}
{% endblock %}