roannais-icitoyen: use select2 for "choix commune" cell (#41678)
This commit is contained in:
parent
34c9564a12
commit
7efbe596b2
|
@ -779,6 +779,18 @@ div.carrousel-content {
|
|||
}
|
||||
}
|
||||
|
||||
// cell Choix commune
|
||||
// use select2 autocomplète
|
||||
#form-cell-choix-commune {
|
||||
span.select2-container {
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
}
|
||||
div.select2-container, span.select2-container {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
// WCS
|
||||
div#gauche {
|
||||
@media ($max-mobile-viewport) {
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"variables": {
|
||||
"pwa_display": "standalone",
|
||||
"theme_color": "#ff3300",
|
||||
"email_header_asset": "emails:logo"
|
||||
"email_header_asset": "emails:logo",
|
||||
"included_js_libraries": ["jquery.js", "select2.js"]
|
||||
},
|
||||
"settings": {
|
||||
"combo": {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
{% if title %}<h2>{{ title }}</h2>{% endif %}
|
||||
<div>
|
||||
{% include "combo/asset_picture_fragment.html" %}
|
||||
<form>
|
||||
<select id="select-choix-commune">
|
||||
<option value="">-- Sélectionnez --</option>
|
||||
<form id="form-cell-choix-commune">
|
||||
<select id="select-cell-choix-commune" class="select-cell-choix-commune">
|
||||
<option value="">Sélectionnez</option>
|
||||
{% for link in links %}
|
||||
<option value="{{ link.url }}">{{ link.title }}</option>
|
||||
{% endfor %}
|
||||
|
@ -20,13 +20,14 @@
|
|||
|
||||
<script>
|
||||
$(function() {
|
||||
$('#select-choix-commune').on('change', function(e){
|
||||
e.preventDefault;
|
||||
var link = this.value;
|
||||
if (!link) {
|
||||
return;
|
||||
}
|
||||
window.location.href = link;
|
||||
});
|
||||
$('#select-cell-choix-commune')
|
||||
.select2()
|
||||
.on('select2:select', function(e){
|
||||
var link = e.params.data.id;
|
||||
if (!link) {
|
||||
return;
|
||||
}
|
||||
window.location.href = link;
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "combo/page_template.html" %}
|
||||
{% load combo gadjo %}
|
||||
|
||||
{% block extra_top_head_js %}
|
||||
{{ block.super }}
|
||||
<link rel="stylesheet" type="text/css" href="{{eservices_url}}static/js/select2/select2.css">
|
||||
<script src="{{eservices_url}}static/js/select2/select2.js"></script>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue