Skip to content

Commit

Permalink
autocomplete: add placeholder to search input
Browse files Browse the repository at this point in the history
  • Loading branch information
brmzkw committed Jan 25, 2024
1 parent 23f5ac1 commit bbb81bc
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 4 deletions.
6 changes: 6 additions & 0 deletions mesads/templates/webpack/base-sidemenu.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,10 @@
</div>
</div>
</main>
{% endblock %}

{% block endbody %}
{{ block.super }}

<script src="base.ts"></script>
{% endblock %}
6 changes: 6 additions & 0 deletions mesads/templates/webpack/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@

{% block body %}{% endblock %}
</main>
{% endblock %}

{% block endbody %}
{{ block.super }}

<script src="base.ts"></script>
{% endblock %}
12 changes: 12 additions & 0 deletions mesads/templates/webpack/base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// For all the select using autocomplete light, add a listener to the open event
// and change the placeholder of the search input.
// There is no built-in way to do this, hence the hack.
// See https://forums.select2.org/t/additional-placeholder-in-search-input/325
$("select[data-autocomplete-light-url]").map((idx, el) =>
$(el).one("select2:open", (e) => {
$("input.select2-search__field").prop(
"placeholder",
"Entrez une valeur ici pour rechercher dans la liste"
);
})
);
1 change: 1 addition & 0 deletions mesads/templates/webpack/pages/ads_register/ads.html
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@ <h1>
{% endblock %}

{% block endbody %}
{{ block.super }}
{% comment %}Extra javascript required to display epci_commune_form.{% endcomment %}
{{ form.media }}
{% endblock %}
4 changes: 3 additions & 1 deletion mesads/templates/webpack/pages/ads_register/ads_manager.html
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,7 @@ <h3 class="fr-accordion__title">
{% endblock %}

{% block endbody %}
{{ edit_form.media }}
{{ block.super }}

{{ edit_form.media }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ <h3 class="fr-alert__title">Un problème ? Contactez-nous !</h3>
{% endblock %}

{% block endbody %}
{{ block.super }}

{% comment %}Extra javascript to display form for new requests.{% endcomment %}
{{ form.media }}

Expand Down Expand Up @@ -254,6 +256,5 @@ <h3 class="fr-alert__title">Un problème ? Contactez-nous !</h3>
});
</script>


<script src="ads_manager_request.ts"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
{% endblock %}

{% block endbody %}
<script src="leaflet/dist/leaflet.js"></script>
<script src="./dashboards_list.ts"></script>
{{ block.super }}

<script src="leaflet/dist/leaflet.js"></script>
<script src="./dashboards_list.ts"></script>
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
{% endblock %}

{% block endbody %}
{{ block.super }}

{% comment %}Extra javascript required to display commune_localisation field.{% endcomment %}
{{ form.media }}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ <h3 class="fr-alert__title">Si vous êtes propriétaire d'un taxi relais, nous v
{% endblock %}

{% block endbody %}
{{ block.super }}

{% comment %}Extra javascript to display form for new requests.{% endcomment %}
{{ form.media }}
{% endblock %}

0 comments on commit bbb81bc

Please sign in to comment.