Correctly initialize page chooser search results for multiple selection

pull/12643/head
Matt Westcott 2024-11-30 02:50:37 +00:00 zatwierdzone przez Sage Abdullah
rodzic 8da1796d53
commit 28cde800d9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: EB1A33CC51CC0217
2 zmienionych plików z 19 dodań i 10 usunięć
client/src/entrypoints/admin
wagtail/admin/views

Wyświetl plik

@ -69,6 +69,16 @@ const PAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = {
$(this).data('timer', wait);
});
function updateMultipleChoiceSubmitEnabledState() {
// update the enabled state of the multiple choice submit button depending on whether
// any items have been selected
if ($('[data-multiple-choice-select]:checked', modal.body).length) {
$('[data-multiple-choice-submit]', modal.body).removeAttr('disabled');
} else {
$('[data-multiple-choice-submit]', modal.body).attr('disabled', true);
}
}
/* Set up behaviour of choose-page links in the newly-loaded search results,
to pass control back to the calling page */
function ajaxifySearchResults() {
@ -95,16 +105,11 @@ const PAGE_CHOOSER_MODAL_ONLOAD_HANDLERS = {
modal.loadUrl(this.href);
return false;
});
}
function updateMultipleChoiceSubmitEnabledState() {
// update the enabled state of the multiple choice submit button depending on whether
// any items have been selected
if ($('[data-multiple-choice-select]:checked', modal.body).length) {
$('[data-multiple-choice-submit]', modal.body).removeAttr('disabled');
} else {
$('[data-multiple-choice-submit]', modal.body).attr('disabled', true);
}
updateMultipleChoiceSubmitEnabledState();
$('[data-multiple-choice-select]', modal.body).on('change', () => {
updateMultipleChoiceSubmitEnabledState();
});
}
function ajaxifyBrowseResults() {

Wyświetl plik

@ -408,7 +408,11 @@ class SearchView(View):
@property
def columns(self):
cols = [
PageTitleColumn("title", label=_("Title")),
PageTitleColumn(
"title",
label=_("Title"),
is_multiple_choice=self.is_multiple_choice,
),
ParentPageColumn("parent", label=_("Parent")),
DateColumn(
"updated",