0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

[refactor] Move bulk action related elements to separate templates for reusability, and make aria label strings translatable

This commit is contained in:
Shohan 2021-07-16 17:10:46 +05:30 committed by Matt Westcott
parent bc24f1eb5e
commit 6163609655
6 changed files with 31 additions and 19 deletions

View File

@ -0,0 +1,11 @@
{% load wagtailadmin_tags i18n %}
<footer class="footer bulk-actions-choices hidden">
<div class="footer__container">
<div class="bulk-actions-filter-checkbox">
<input type="checkbox" aria-label='{% trans "Bulk action checkbox" %}' />
</div>
<ul>{% page_bulk_action_choices %}</ul>
<span class="num-pages"></span>
<a class="num-pages-in-listing u-hidden" href='#'>{{ select_all_obj_text }}</a>
</div>
</footer>

View File

@ -0,0 +1,8 @@
{% load i18n wagtailadmin_tags %}
<td>
<input
{% if obj_type == 'page' %}
data-page-status="{% if obj.live %}live{% else %}draft{% endif %}"
{% endif %}
data-page-id="{{obj.id}}" class="bulk-action-checkbox" aria-label="{{checkbox_aria_label}}" type="checkbox" />
</td>

View File

@ -0,0 +1,7 @@
{% load i18n wagtailadmin_tags %}
<th class="bulk-actions-filter-checkbox" data-parent-id="{{ parent.id }}">
<div>
<input type="checkbox" aria-label='{% trans "Bulk action checkbox" }' />
{% bulk_action_filters %}
</div>
</th>

View File

@ -20,16 +20,8 @@
{% url 'wagtailadmin_explore' parent_page.id as pagination_base_url %}
{% paginate pages base_url=pagination_base_url %}
{% endif %}
<footer class="footer bulk-actions-choices hidden">
<div class="footer__container">
<div class="bulk-actions-filter-checkbox">
<input type="checkbox" aria-label="Bulk action checkbox" />
</div>
<ul>{% page_bulk_action_choices %}</ul>
<span class="num-pages"></span>
<a class="num-pages-in-listing u-hidden" href='#'>{% trans "Select all pages in listing" %}</a>
</div>
</footer>
{% trans "Select all pages in listing" as select_all_text %}
{% include 'wagtailadmin/bulk_actions/footer.html' with select_all_obj_text=select_all_text %}
</form>
{% endblock %}

View File

@ -42,15 +42,14 @@
</thead>
<tbody>
{% if pages %}
{% trans "Page select checkbox" as checkbox_aria_label %}
{% for page in pages %}
{% page_permissions page as page_perms %}
<tr {% if ordering == "ord" %}id="page_{{ page.id|unlocalize }}" data-page-title="{{ page.get_admin_display_title }}"{% endif %} class="{% if not page.live %}unpublished{% endif %} {% block page_row_classname %}{% endblock %}">
{% if show_ordering_column %}
<td class="ord">{% if orderable and ordering == "ord" %}<div class="handle icon icon-grip text-replace">{% trans 'Drag' %}</div>{% endif %}</td>
{% else %}
<td>
<input data-page-status="{% if page.live %}live{% else %}draft{% endif %}" data-page-id="{{page.id}}" class="bulk-action-checkbox" aria-label="Page select checkbox" type="checkbox" />
</td>
{% include 'wagtailadmin/bulk_actions/listing_checkbox_cell.html' with obj_type='page' obj=page aria_label=checkbox_aria_label %}
{% endif %}
<td class="title" valign="top" data-listing-page-title>
{% block page_title %}

View File

@ -32,12 +32,7 @@ ordering: the current sort parameter
{% endif %}
</th>
{% else %}
<th class="bulk-actions-filter-checkbox" data-parent-id="{{ parent_page.id }}">
<div>
<input type="checkbox" aria-label="Bulk action checkbox" />
{% bulk_action_filters %}
</div>
</th>
{% include 'wagtailadmin/bulk_actions/select_all_checkbox_cell.html' with parent=parent_page %}
{% endif %}
<th class="title">
{% trans 'Page' %}