Tidy up based on code review

pull/7618/head
Dan Braghis 2021-10-10 18:13:55 +01:00 zatwierdzone przez Matt Westcott
rodzic 2688bb062c
commit d19e1b4380
29 zmienionych plików z 144 dodań i 132 usunięć

Wyświetl plik

@ -75,12 +75,16 @@
border-radius: 4px 4px 0 0;
margin-left: 30px;
input[type="checkbox"] {
margin-right: 1.25em;
}
.bulk-actions-buttons {
border-left: 1px solid $color-grey-2;
padding-left: 1.5em;
.bulk-action-btn {
max-width: 150px;
max-width: 160px;
overflow-x: hidden;
text-overflow: ellipsis;
border: 0;
@ -96,7 +100,7 @@
color: $color-teal-light;
background-color: transparent;
border: 0;
font-family: 'Open Sans';
font-family: Open Sans, Arial, sans-serif;
padding: 0;
}

Wyświetl plik

@ -679,12 +679,19 @@ table.listing {
}
tr:hover,
li:hover {
tr:focus-within {
.no-children a,
.bulk-action-checkbox {
opacity: 1;
}
}
// used on the image listing
li:hover,
li:focus-within {
.bulk-action-checkbox {
opacity: 1;
}
}
tr:hover .children {

Wyświetl plik

@ -3,9 +3,9 @@
const BULK_ACTION_PAGE_CHECKBOX_INPUT = '[data-bulk-action-checkbox]';
const BULK_ACTION_SELECT_ALL_CHECKBOX = '[data-bulk-action-select-all-checkbox]';
const BULK_ACTIONS_CHECKBOX_PARENT = '[data-bulk-action-parent-id]';
const BULK_ACTION_FILTERS_CLASS = '[data-bulk-action-filter]';
const BULK_ACTION_CHOICES_DIV = '[data-bulk-action-footer]';
const BULK_ACTION_NUM_OBJECTS_SPAN = '[data-bulk-action-num-objects]';
const BULK_ACTION_FILTER = '[data-bulk-action-filter]';
const BULK_ACTION_FOOTER = '[data-bulk-action-footer]';
const BULK_ACTION_NUM_OBJECTS = '[data-bulk-action-num-objects]';
const BULK_ACTION_NUM_OBJECTS_IN_LISTING = '[data-bulk-action-num-objects-in-listing]';
const checkedState = {
@ -19,34 +19,35 @@ const checkedState = {
/**
* Utility function to get the appropriate string for display in action bar
*/
function getAppropriateStringForListing(key) {
if (wagtailConfig.BULK_ACTION_ITEM_TYPE in wagtailConfig.STRINGS.BULK_ACTIONS) {
function getStringForListing(key) {
if (wagtailConfig.STRINGS.BULK_ACTIONS[wagtailConfig.BULK_ACTION_ITEM_TYPE]) {
return wagtailConfig.STRINGS.BULK_ACTIONS[wagtailConfig.BULK_ACTION_ITEM_TYPE][key];
}
return wagtailConfig.STRINGS.BULK_ACTIONS.item[key];
return wagtailConfig.STRINGS.BULK_ACTIONS.ITEM[key];
}
/**
* Event listener for the `Select All` checkbox
*/
function onSelectAllChange(e) {
document.querySelectorAll(`${BULK_ACTION_SELECT_ALL_CHECKBOX}`).forEach(el => {
document.querySelectorAll(BULK_ACTION_SELECT_ALL_CHECKBOX).forEach(el => {
el.checked = e.target.checked; // eslint-disable-line no-param-reassign
});
const changeEvent = new Event('change');
for (const el of document.querySelectorAll(`${BULK_ACTION_PAGE_CHECKBOX_INPUT}`)) {
if (el.checked === e.target.checked) continue;
el.checked = e.target.checked;
if (e.target.checked) {
el.dispatchEvent(changeEvent);
} else {
el.classList.remove('show');
document.querySelectorAll(BULK_ACTION_PAGE_CHECKBOX_INPUT).forEach(el => {
if (el.checked !== e.target.checked) {
el.checked = e.target.checked;
if (e.target.checked) {
el.dispatchEvent(changeEvent);
} else {
el.classList.remove('show');
}
}
}
});
if (!e.target.checked) {
// when deselecting all checkbox, simply hide the footer for smooth transition
checkedState.checkedObjects.clear();
document.querySelector(`${BULK_ACTION_CHOICES_DIV}`).classList.add('hidden');
document.querySelector(BULK_ACTION_FOOTER).classList.add('hidden');
}
}
@ -61,51 +62,51 @@ function onSelectIndividualCheckbox(e) {
checkedState.checkedObjects.add(Number(e.target.dataset.objectId));
} else {
/* unchecks `Select all` checkbox as soon as one page is unchecked */
document.querySelectorAll(`${BULK_ACTION_SELECT_ALL_CHECKBOX}`).forEach(el => {
document.querySelectorAll(BULK_ACTION_SELECT_ALL_CHECKBOX).forEach(el => {
el.checked = false; // eslint-disable-line no-param-reassign
});
checkedState.checkedObjects.delete(+e.target.dataset.objectId);
checkedState.checkedObjects.delete(Number(e.target.dataset.objectId));
}
const numCheckedObjects = checkedState.checkedObjects.size;
if (numCheckedObjects === 0) {
/* when all checkboxes are unchecked */
document.querySelector(`${BULK_ACTION_CHOICES_DIV}`).classList.add('hidden');
document.querySelectorAll(`${BULK_ACTION_PAGE_CHECKBOX_INPUT}`).forEach(el => el.classList.remove('show'));
document.querySelector(BULK_ACTION_FOOTER).classList.add('hidden');
document.querySelectorAll(BULK_ACTION_PAGE_CHECKBOX_INPUT).forEach(el => el.classList.remove('show'));
} else if (numCheckedObjects === 1 && prevLength === 0) {
/* when 1 checkbox is checked for the first time */
document.querySelectorAll(`${BULK_ACTION_PAGE_CHECKBOX_INPUT}`).forEach(el => {
document.querySelectorAll(BULK_ACTION_PAGE_CHECKBOX_INPUT).forEach(el => {
el.classList.add('show');
});
document.querySelector(`${BULK_ACTION_CHOICES_DIV}`).classList.remove('hidden');
document.querySelector(BULK_ACTION_FOOTER).classList.remove('hidden');
}
if (numCheckedObjects === checkedState.numObjects) {
/* when all checkboxes in the page are checked */
document.querySelectorAll(`${BULK_ACTION_SELECT_ALL_CHECKBOX}`).forEach(el => {
document.querySelectorAll(BULK_ACTION_SELECT_ALL_CHECKBOX).forEach(el => {
el.checked = true; // eslint-disable-line no-param-reassign
});
if (checkedState.shouldShowAllInListingText) {
document.querySelector(`${BULK_ACTION_NUM_OBJECTS_IN_LISTING}`).classList.remove('u-hidden');
document.querySelector(BULK_ACTION_NUM_OBJECTS_IN_LISTING).classList.remove('u-hidden');
}
} else if (checkedState.shouldShowAllInListingText) {
document.querySelector(`${BULK_ACTION_NUM_OBJECTS_IN_LISTING}`).classList.add('u-hidden');
document.querySelector(BULK_ACTION_NUM_OBJECTS_IN_LISTING).classList.add('u-hidden');
}
if (numCheckedObjects > 0) {
/* Update text on number of pages */
let numObjectsSelected = '';
if (numCheckedObjects === 1) {
numObjectsSelected = getAppropriateStringForListing('SINGULAR');
numObjectsSelected = getStringForListing('SINGULAR');
} else {
if (numCheckedObjects === checkedState.numObjects) {
numObjectsSelected = getAppropriateStringForListing('ALL').replace('{0}', numCheckedObjects);
numObjectsSelected = getStringForListing('ALL').replace('{0}', numCheckedObjects);
} else {
numObjectsSelected = getAppropriateStringForListing('PLURAL').replace('{0}', numCheckedObjects);
numObjectsSelected = getStringForListing('PLURAL').replace('{0}', numCheckedObjects);
}
}
document.querySelector(`${BULK_ACTION_NUM_OBJECTS_SPAN}`).textContent = numObjectsSelected;
document.querySelector(BULK_ACTION_NUM_OBJECTS).textContent = numObjectsSelected;
}
}
@ -115,9 +116,9 @@ function onSelectIndividualCheckbox(e) {
function onClickSelectAllInListing(e) {
e.preventDefault();
checkedState.selectAllInListing = true;
document.querySelector(`${BULK_ACTION_NUM_OBJECTS_SPAN}`).
textContent = `${getAppropriateStringForListing('ALL_IN_LISTING')}.`;
document.querySelector(`${BULK_ACTION_NUM_OBJECTS_IN_LISTING}`).classList.add('u-hidden');
document.querySelector(BULK_ACTION_NUM_OBJECTS).
textContent = `${getStringForListing('ALL_IN_LISTING')}.`;
document.querySelector(BULK_ACTION_NUM_OBJECTS_IN_LISTING).classList.add('u-hidden');
}
/**
@ -132,8 +133,8 @@ function onClickFilter(e) {
BULK_ACTION_PAGE_CHECKBOX_INPUT dataset */
const [_key, value] = filter.split(':');
const key = `${_key[0].toUpperCase()}${_key.slice(1)}`;
for (const el of document.querySelectorAll(`${BULK_ACTION_PAGE_CHECKBOX_INPUT}`)) {
if (`page${key}` in el.dataset) {
for (const el of document.querySelectorAll(BULK_ACTION_PAGE_CHECKBOX_INPUT)) {
if (el.dataset[`page${key}`]) {
if (el.dataset[`page${key}`] === value) {
if (!el.checked) {
el.checked = true;
@ -149,10 +150,10 @@ function onClickFilter(e) {
}
} else {
/* If filter string is empty, select all checkboxes */
document.querySelectorAll(`.${BULK_ACTION_SELECT_ALL_CHECKBOX}`).forEach(el => {
document.querySelectorAll(BULK_ACTION_SELECT_ALL_CHECKBOX).forEach(el => {
el.checked = true; // eslint-disable-line no-param-reassign
});
document.querySelector(`.${BULK_ACTION_SELECT_ALL_CHECKBOX}`).dispatchEvent(changeEvent);
document.querySelector(BULK_ACTION_SELECT_ALL_CHECKBOX).dispatchEvent(changeEvent);
}
}
@ -163,7 +164,7 @@ function onClickActionButton(e) {
e.preventDefault();
const url = e.target.getAttribute('href');
const urlParams = new URLSearchParams();
const parentElement = document.querySelector(`${BULK_ACTIONS_CHECKBOX_PARENT}`);
const parentElement = document.querySelector(BULK_ACTIONS_CHECKBOX_PARENT);
if (checkedState.selectAllInListing && parentElement) {
const parentPageId = parentElement.dataset.bulkActionParentId;
urlParams.append('id', 'all');
@ -182,24 +183,24 @@ function onClickActionButton(e) {
*/
function addBulkActionListeners() {
const changeEvent = new Event('change');
document.querySelectorAll(`${BULK_ACTION_PAGE_CHECKBOX_INPUT}`)
document.querySelectorAll(BULK_ACTION_PAGE_CHECKBOX_INPUT)
.forEach(el => {
checkedState.numObjects++;
el.addEventListener('change', onSelectIndividualCheckbox);
});
document.querySelectorAll(`${BULK_ACTION_SELECT_ALL_CHECKBOX}`).forEach(el => {
document.querySelectorAll(BULK_ACTION_SELECT_ALL_CHECKBOX).forEach(el => {
el.addEventListener('change', onSelectAllChange);
});
document.querySelectorAll(`${BULK_ACTION_FILTERS_CLASS}`).forEach(
document.querySelectorAll(BULK_ACTION_FILTER).forEach(
elem => elem.addEventListener('click', onClickFilter)
);
document.querySelectorAll(`${BULK_ACTION_CHOICES_DIV} .bulk-action-btn`).forEach(
document.querySelectorAll(`${BULK_ACTION_FOOTER} .bulk-action-btn`).forEach(
elem => elem.addEventListener('click', onClickActionButton)
);
const selectAllInListingText = document.querySelector(`${BULK_ACTION_NUM_OBJECTS_IN_LISTING}`);
const selectAllInListingText = document.querySelector(BULK_ACTION_NUM_OBJECTS_IN_LISTING);
if (selectAllInListingText) selectAllInListingText.addEventListener('click', onClickSelectAllInListing);
else checkedState.shouldShowAllInListingText = false;
document.querySelectorAll(`${BULK_ACTION_PAGE_CHECKBOX_INPUT}`)
document.querySelectorAll(BULK_ACTION_PAGE_CHECKBOX_INPUT)
.forEach(el => {
if (el.checked) {
el.dispatchEvent(changeEvent);
@ -209,25 +210,25 @@ function addBulkActionListeners() {
function rebindBulkActionsEventListeners() {
// when deselecting all checkbox, simply hide the footer for smooth transition
document.querySelectorAll(`${BULK_ACTION_SELECT_ALL_CHECKBOX}`).forEach(el => {
document.querySelectorAll(BULK_ACTION_SELECT_ALL_CHECKBOX).forEach(el => {
el.checked = false; // eslint-disable-line no-param-reassign
});
document.querySelector(`${BULK_ACTION_CHOICES_DIV}`).classList.add('hidden');
document.querySelectorAll(`${BULK_ACTION_SELECT_ALL_CHECKBOX}`).forEach(el => {
document.querySelector(BULK_ACTION_FOOTER).classList.add('hidden');
document.querySelectorAll(BULK_ACTION_SELECT_ALL_CHECKBOX).forEach(el => {
// remove already attached event listener first
el.removeEventListener('change', onSelectAllChange);
el.addEventListener('change', onSelectAllChange);
});
checkedState.checkedObjects.clear();
checkedState.numObjects = 0;
document.querySelectorAll(`${BULK_ACTION_PAGE_CHECKBOX_INPUT}`)
document.querySelectorAll(BULK_ACTION_PAGE_CHECKBOX_INPUT)
.forEach(el => {
checkedState.numObjects++;
el.addEventListener('change', onSelectIndividualCheckbox);
});
}
window.addEventListener('load', addBulkActionListeners);
document.addEventListener('DOMContentLoaded', addBulkActionListeners);
if (window.headerSearch) {
document.querySelector(window.headerSearch.termInput).addEventListener(
'search-success', rebindBulkActionsEventListeners

Wyświetl plik

@ -18,7 +18,7 @@ Registering a custom bulk action
@hooks.register('register_bulk_action')
class CustomDeleteBulkAction(BulkAction):
display_name = _("Delete")
aria_label = _("Delete objects")
aria_label = _("Delete selected objects")
action_type = "delete"
template_name = "/path/to/confirm_bulk_delete.html"
models = [...]

Wyświetl plik

@ -7,4 +7,4 @@
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}

Wyświetl plik

@ -1,11 +1,12 @@
{% load wagtailadmin_tags i18n %}
<footer class="footer bulk-actions-choices hidden" data-bulk-action-footer>
{% load i18n wagtailadmin_tags %}
<section class="footer bulk-actions-choices hidden" data-bulk-action-footer aria-labelledby="bulk-actions-heading">
<h2 id="bulk-actions-heading" class="visuallyhidden">{% trans "Bulk actions" %}</h2>
<div class="footer__container">
<input data-bulk-action-select-all-checkbox type="checkbox" aria-label='{% trans "Select all" %}' />
<ul>{% bulk_action_choices app_label model_name %}</ul>
<ul class="bulk-actions-buttons">{% bulk_action_choices app_label model_name %}</ul>
<span data-bulk-action-num-objects class="num-objects"></span>
{% if select_all_obj_text and objects.has_other_pages %}
<button data-bulk-action-num-objects-in-listing class="num-objects-in-listing u-hidden">{{ select_all_obj_text }}</button>
{% endif %}
</div>
</footer>
</section>

Wyświetl plik

@ -9,25 +9,25 @@
{% endblock header %}
{% block items_with_access %}
{% if items %}
<p>{% trans "Are you sure you want to publish these pages?" %}</p>
<ul>
{% for page in items %}
<li>
<a href="{% url 'wagtailadmin_pages:edit' page.item.id %}" target="_blank" rel="noopener noreferrer">{{ page.item.title }}</a>
{% if page.draft_descendant_count %}
<p>
{% blocktrans count counter=page.draft_descendant_count %}
This page has one unpublished subpage
{% plural %}
This page has {{ counter }} unpublished subpages
{% endblocktrans %}
</p>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% if items %}
<p>{% trans "Are you sure you want to publish these pages?" %}</p>
<ul>
{% for page in items %}
<li>
<a href="{% url 'wagtailadmin_pages:edit' page.item.id %}" target="_blank" rel="noopener noreferrer">{{ page.item.title }}</a>
{% if page.draft_descendant_count %}
<p>
{% blocktrans count counter=page.draft_descendant_count %}
This page has one unpublished subpage
{% plural %}
This page has {{ counter }} unpublished subpages
{% endblocktrans %}
</p>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock items_with_access %}
{% block items_with_no_access %}

Wyświetl plik

@ -9,25 +9,25 @@
{% endblock header %}
{% block items_with_access %}
{% if items %}
<p>{% trans "Are you sure you want to unpublish these pages?" %}</p>
<ul>
{% for page in items %}
<li>
<a href="{% url 'wagtailadmin_pages:edit' page.item.id %}" target="_blank" rel="noopener noreferrer">{{ page.item.title }}</a>
<p>
{% if page.live_descendant_count %}
{% blocktrans count counter=page.live_descendant_count %}
This page has one subpage
{% plural %}
This page has {{ counter }} subpages
{% endblocktrans %}
{% endif %}
</p>
</li>
{% endfor %}
</ul>
{% endif %}
{% if items %}
<p>{% trans "Are you sure you want to unpublish these pages?" %}</p>
<ul>
{% for page in items %}
<li>
<a href="{% url 'wagtailadmin_pages:edit' page.item.id %}" target="_blank" rel="noopener noreferrer">{{ page.item.title }}</a>
<p>
{% if page.live_descendant_count %}
{% blocktrans count counter=page.live_descendant_count %}
This page has one subpage
{% plural %}
This page has {{ counter }} subpages
{% endblocktrans %}
{% endif %}
</p>
</li>
{% endfor %}
</ul>
{% endif %}
{% endblock items_with_access %}
{% block items_with_no_access %}

Wyświetl plik

@ -2,9 +2,9 @@
{% load i18n %}
{% block per_item %}
{% if item.can_edit %}
{% if item.can_edit %}
<a href="{% url 'wagtailadmin_pages:edit' item.item.id %}" target="_blank" rel="noopener noreferrer">{{ item.item.title }}</a>
{% else %}
{% else %}
{{ item.item.title }}
{% endif %}
{% endif %}
{% endblock per_item %}

Wyświetl plik

@ -7,7 +7,7 @@ from wagtail.admin.views.pages.bulk_actions.page_bulk_action import PageBulkActi
class DeleteBulkAction(PageBulkAction):
display_name = _("Delete")
action_type = "delete"
aria_label = "Delete pages"
aria_label = _("Delete selected pages")
template_name = "wagtailadmin/pages/bulk_actions/confirm_bulk_delete.html"
action_priority = 30
classes = {'serious'}

Wyświetl plik

@ -28,7 +28,7 @@ class MoveForm(forms.Form):
class MoveBulkAction(PageBulkAction):
display_name = _("Move")
action_type = "move"
aria_label = "Move pages"
aria_label = _("Move selected pages")
template_name = "wagtailadmin/pages/bulk_actions/confirm_bulk_move.html"
action_priority = 10
form_class = MoveForm

Wyświetl plik

@ -7,7 +7,7 @@ from wagtail.admin.views.pages.bulk_actions.page_bulk_action import PageBulkActi
class PublishBulkAction(PageBulkAction):
display_name = _("Publish")
action_type = "publish"
aria_label = _("Publish pages")
aria_label = _("Publish selected pages")
template_name = "wagtailadmin/pages/bulk_actions/confirm_bulk_publish.html"
action_priority = 40

Wyświetl plik

@ -7,7 +7,7 @@ from wagtail.admin.views.pages.bulk_actions.page_bulk_action import PageBulkActi
class UnpublishBulkAction(PageBulkAction):
display_name = _("Unpublish")
action_type = "unpublish"
aria_label = _("Unpublish pages")
aria_label = _("Unpublish selected pages")
template_name = "wagtailadmin/pages/bulk_actions/confirm_bulk_unpublish.html"
action_priority = 50

Wyświetl plik

@ -23,7 +23,7 @@
{% block items_with_access %}
{% if items %}
<p>
{% blocktrans count counter=items|length %}
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to tag the following document?
{% plural %}
Are you sure you want to tag the following documents?
@ -40,7 +40,7 @@
{% endblock items_with_access %}
{% block items_with_no_access %}
{% blocktrans asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to add tags to this document{% plural %}You don't have permission to add tags to these documents{% endblocktrans %}
{% include 'wagtaildocs/bulk_actions/list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}

Wyświetl plik

@ -11,7 +11,7 @@
{% block items_with_access %}
{% if items %}
<p>
{% blocktrans count counter=items|length %}
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to add the following document to the selected collection?
{% plural %}
Are you sure you want to add the following documents to the selected collection?

Wyświetl plik

@ -10,7 +10,7 @@
{% block items_with_access %}
{% if items %}
<p>
{% blocktrans count counter=items|length %}
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to delete this document?
{% plural %}
Are you sure you want to delete these documents?

Wyświetl plik

@ -13,7 +13,7 @@ class TagForm(forms.Form):
class AddTagsBulkAction(DocumentBulkAction):
display_name = _("Tag")
action_type = "add_tags"
aria_label = _("Add tags to documents")
aria_label = _("Add tags to the selected documents")
template_name = "wagtaildocs/bulk_actions/confirm_bulk_add_tags.html"
action_priority = 20
form_class = TagForm

Wyświetl plik

@ -17,7 +17,7 @@ class CollectionForm(forms.Form):
class AddToCollectionBulkAction(DocumentBulkAction):
display_name = _("Add to collection")
action_type = "add_to_collection"
aria_label = _("Add documents to collection")
aria_label = _("Add selected documents to collection")
template_name = "wagtaildocs/bulk_actions/confirm_bulk_add_to_collection.html"
action_priority = 30
form_class = CollectionForm

Wyświetl plik

@ -7,7 +7,7 @@ from wagtail.documents.views.bulk_actions.document_bulk_action import DocumentBu
class DeleteBulkAction(DocumentBulkAction):
display_name = _("Delete")
action_type = "delete"
aria_label = _("Delete documents")
aria_label = _("Delete selected documents")
template_name = "wagtaildocs/bulk_actions/confirm_bulk_delete.html"
action_priority = 100
classes = {'serious'}

Wyświetl plik

@ -23,7 +23,7 @@
{% block items_with_access %}
{% if items %}
<p>
{% blocktrans count counter=items|length %}
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to tag the following image?
{% plural %}
Are you sure you want to tag the following images?
@ -40,7 +40,7 @@
{% endblock items_with_access %}
{% block items_with_no_access %}
{% blocktrans asvar no_access_msg count counter=items_with_no_access|length %}You don't have permission to add tags to this image{% plural %}You don't have permission to add tags to these images{% endblocktrans %}
{% include 'wagtailimages/bulk_actions/list_items_with_no_access.html' with items=items_with_no_access no_access_msg=no_access_msg %}
@ -54,4 +54,4 @@
{% else %}
{% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
{% endif %}
{% endblock form_section %}
{% endblock form_section %}

Wyświetl plik

@ -9,9 +9,9 @@
{% endblock header %}
{% block items_with_access %}
{% if items %}
{% if items %}
<p>
{% blocktrans count counter=items|length %}
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to add the following image to the selected collection?
{% plural %}
Are you sure you want to add the following images to the selected collection?
@ -24,7 +24,7 @@
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endblock items_with_access %}
{% block items_with_no_access %}
@ -42,4 +42,4 @@
{% else %}
{% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
{% endif %}
{% endblock form_section %}
{% endblock form_section %}

Wyświetl plik

@ -8,9 +8,9 @@
{% endblock header %}
{% block items_with_access %}
{% if items %}
{% if items %}
<p>
{% blocktrans count counter=items|length %}
{% blocktrans trimmed count counter=items|length %}
Are you sure you want to delete this image?
{% plural %}
Are you sure you want to delete these images?
@ -27,7 +27,7 @@
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endblock items_with_access %}
{% block items_with_no_access %}
@ -45,4 +45,4 @@
{% else %}
{% include 'wagtailadmin/bulk_actions/confirmation/go_back.html' %}
{% endif %}
{% endblock form_section %}
{% endblock form_section %}

Wyświetl plik

@ -2,9 +2,9 @@
{% load i18n %}
{% block per_item %}
{% if item.can_edit %}
{% if item.can_edit %}
<a href="{% url 'wagtailimages:edit' item.item.id %}" target="_blank" rel="noopener noreferrer">{{ item.item.title }}</a>
{% else %}
{% else %}
{{ item.item.title }}
{% endif %}
{% endblock per_item %}
{% endif %}
{% endblock per_item %}

Wyświetl plik

@ -16,17 +16,16 @@
{% endif %}
<ul class="listing horiz images">
{% trans "Select image" as checkbox_aria_label %}
{% for image in images %}
<li>
<div class="bulk-action-checkbox-container">
{% include "wagtailadmin/bulk_actions/listing_checkbox_cell.html" with obj_type="image" obj=image aria_labelledby_prefix="image_" aria_labelledby=image.pk|unlocalize aria_labelledby_suffix="_title" %}
</div>
<a id="image_{{ image.pk|unlocalize }}_title" class="image-choice" title="{% if collections %}{{ image.collection.name }} » {% endif %}{{ image.title }}" href="{% url 'wagtailimages:edit' image.id %}">
<a class="image-choice" title="{% if collections %}{{ image.collection.name }} » {% endif %}{{ image.title }}" href="{% url 'wagtailimages:edit' image.id %}">
<figure>
{% include "wagtailimages/images/results_image.html" %}
{% trans "pixels" as translated_pixels %}
<figcaption>
<figcaption id="image_{{ image.pk|unlocalize }}_title">
{{ image.title|ellipsistrim:60 }}
<span class="visuallyhidden">{{ image.width }} {{ translated_pixels }} &#215; {{ image.height }} {{ translated_pixels}}</span>
</figcaption>

Wyświetl plik

@ -13,7 +13,7 @@ class TagForm(forms.Form):
class AddTagsBulkAction(ImageBulkAction):
display_name = _("Tag")
action_type = "add_tags"
aria_label = _("Add tags to images")
aria_label = _("Add tags to the selected images")
template_name = "wagtailimages/bulk_actions/confirm_bulk_add_tags.html"
action_priority = 20
form_class = TagForm

Wyświetl plik

@ -17,7 +17,7 @@ class CollectionForm(forms.Form):
class AddToCollectionBulkAction(ImageBulkAction):
display_name = _("Add to collection")
action_type = "add_to_collection"
aria_label = _("Add images to collection")
aria_label = _("Add selected images to collection")
template_name = "wagtailimages/bulk_actions/confirm_bulk_add_to_collection.html"
action_priority = 30
form_class = CollectionForm

Wyświetl plik

@ -7,7 +7,7 @@ from wagtail.images.views.bulk_actions.image_bulk_action import ImageBulkAction
class DeleteBulkAction(ImageBulkAction):
display_name = _("Delete")
action_type = "delete"
aria_label = _("Delete images")
aria_label = _("Delete selected images")
template_name = "wagtailimages/bulk_actions/confirm_bulk_delete.html"
action_priority = 100
classes = {'serious'}

Wyświetl plik

@ -16,7 +16,7 @@ class RoleForm(forms.Form):
class AssignRoleBulkAction(UserBulkAction):
display_name = _("Assign role")
action_type = "assign_role"
aria_label = _("Assign role to users")
aria_label = _("Assign role to selected users")
template_name = "wagtailusers/bulk_actions/confirm_bulk_assign_role.html"
action_priority = 30
form_class = RoleForm

Wyświetl plik

@ -8,7 +8,7 @@ from wagtail.users.views.bulk_actions.user_bulk_action import UserBulkAction
class DeleteBulkAction(UserBulkAction):
display_name = _("Delete")
action_type = "delete"
aria_label = _("Delete users")
aria_label = _("Delete selected users")
template_name = "wagtailusers/bulk_actions/confirm_bulk_delete.html"
action_priority = 10
classes = {'serious'}