Adopt a standard data-chooser-modal-search attribute to identify the search form

pull/8555/head
Matt Westcott 2022-05-19 17:01:32 +01:00 zatwierdzone przez LB (Ben Johnston)
rodzic b958585ff8
commit b45d2a0973
5 zmienionych plików z 4 dodań i 5 usunięć

Wyświetl plik

@ -58,7 +58,6 @@ class DocumentChooserModalOnloadHandlerFactory extends ChooserModalOnloadHandler
window.DOCUMENT_CHOOSER_MODAL_ONLOAD_HANDLERS =
new DocumentChooserModalOnloadHandlerFactory({
searchFormSelector: 'form.document-search',
searchFilterSelectors: ['#collection_chooser_collection_id'],
searchInputDelay: 50,
chosenResponseName: 'documentChosen',

Wyświetl plik

@ -2,7 +2,6 @@ import { ChooserModalOnloadHandlerFactory } from '../../includes/chooserModal';
window.SNIPPET_CHOOSER_MODAL_ONLOAD_HANDLERS =
new ChooserModalOnloadHandlerFactory({
searchFormSelector: 'form.snippet-search',
searchFilterSelectors: ['#snippet-chooser-locale'],
chosenResponseName: 'snippetChosen',
}).getOnLoadHandlers();

Wyświetl plik

@ -151,7 +151,8 @@ class ChooserModalOnloadHandlerFactory {
opts?.chosenLinkSelector || 'a[data-chooser-modal-choice]';
this.paginationLinkSelector =
opts?.paginationLinkSelector || '.pagination a';
this.searchFormSelector = opts?.searchFormSelector || 'form[data-search]';
this.searchFormSelector =
opts?.searchFormSelector || 'form[data-chooser-modal-search]';
this.resultsContainerSelector =
opts?.resultsContainerSelector || '#search-results';
this.searchInputSelectors = opts?.searchInputSelectors || ['#id_q'];

Wyświetl plik

@ -25,7 +25,7 @@
role="tabpanel"
aria-labelledby="tab-label-search"
>
<form class="document-search search-bar" action="{% url 'wagtaildocs:chooser_results' %}" method="GET" novalidate>
<form data-chooser-modal-search class="search-bar" action="{% url 'wagtaildocs:chooser_results' %}" method="GET" novalidate>
<ul class="fields">
{% for field in searchform %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field %}

Wyświetl plik

@ -4,7 +4,7 @@
<div class="nice-padding">
{% if is_searchable or locale or locale_options %}
<form class="snippet-search search-bar" action="{% url 'wagtailsnippets:choose_results' model_opts.app_label model_opts.model_name %}" method="GET" novalidate>
<form data-chooser-modal-search class="search-bar" action="{% url 'wagtailsnippets:choose_results' model_opts.app_label model_opts.model_name %}" method="GET" novalidate>
{% if locale %}
<input type="hidden" name="locale" value="{{ locale.language_code }}">
{% endif %}