saumur: added city selector cell (#71821)

This commit is contained in:
Agate 2022-11-30 11:50:01 +01:00 committed by Gitea
parent 1a2d97e426
commit f8b4ed979b
2 changed files with 33 additions and 0 deletions

View File

@ -216,6 +216,15 @@ div.link-cell {
border: none;
}
}
// communes selector
div#services-communes {
select {
width: 100%;
}
}
// forms
.form-content {
@extend %cell;

View File

@ -0,0 +1,24 @@
{% block cell-content %}
<h2>{{ title }}</h2>
<div class="cell--body">
<form>
<select id="commune--select-{{ cell.id }}">
<option value="">Sélectionnez</option>
{% for link in links %}
<option value="{{ link.url }}">{{ link.title }}</option>
{% endfor %}
</select>
<p>Sélectionnez une commune pour découvrir ses services en ligne.</p>
</form>
</div>
{% endblock %}
<script>
$(function() {
$('#commune--select-{{ cell.id }}').change(function(e){
const link = this.options[this.selectedIndex].value;
if (link) {
window.location.href = link;
}
})
});
</script>