kopia lustrzana https://github.com/wagtail/wagtail
Correctly initialize page chooser search results for multiple selection
rodzic
8da1796d53
commit
28cde800d9
client/src/entrypoints/admin
wagtail/admin/views
|
@ -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() {
|
||||
|
|
|
@ -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",
|
||||
|
|
Ładowanie…
Reference in New Issue