montpellier: make collectivity <select> directly send user to portal (#73119)
This commit is contained in:
parent
974ff93f5e
commit
8a6bed822d
|
@ -59,12 +59,12 @@
|
|||
<h3>Les démarches dans les autres communes</h3>
|
||||
<div>
|
||||
<p>
|
||||
<select onchange="displayCommune(this.value)">
|
||||
<select onchange="displayCommune(this)">
|
||||
<option value="" selected>Choisissez une commune...</option>
|
||||
{% for categories in form_categories.values|dictsort:"title" %}
|
||||
{% with categories.variables|get:"ou-label"|default:categories.title as commune_name %}
|
||||
{% if commune_name != request.session.mellon_session.city.0 and categories.slug != 'agglo' %}
|
||||
<option value="{{ categories.slug }}">{{ commune_name }}</option>
|
||||
<option value="{{ categories.slug }}" data-url="{{ categories.base_url }}tryauth">{{ commune_name }}</option>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
@ -75,44 +75,12 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Blocs des communes -->
|
||||
<div id="toutes-communes">
|
||||
{% for slug, categories in form_categories.items %}
|
||||
{% if categories.title != request.session.mellon_session.city.0 and slug != 'agglo' %}
|
||||
<div id="categories-{{ slug }}" style="display: none;" class="categories-list">
|
||||
{% with categories.variables|get:"ou-label"|default:categories.title as commune_name %}
|
||||
<h3><a href="{{ categories.base_url }}tryauth">Démarches de {{ commune_name }}</a></h3>
|
||||
{% endwith %}
|
||||
{% if categories.data %}
|
||||
<ul class="clearfix">
|
||||
{% for category in categories.data %}
|
||||
<li class="category-{{category.slug}}" data-keywords="{{category.keywords|join:' '}}">
|
||||
<a href="{{ category.url }}tryauth">{{ category.title }}</a>
|
||||
<ul>
|
||||
{% for form in category.forms %}
|
||||
<li {% if form.authentication_required %}class="required-authentication"{% endif %}
|
||||
data-keywords="{{form.keywords|join:' '}}"><a href="{{form.url}}">{{form.title}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function displayCommune(slug) {
|
||||
var communes = document.getElementById('toutes-communes').children;
|
||||
for (var i = 0; i < communes.length; i++) {
|
||||
commune = communes[i];
|
||||
if (commune.id == 'categories-'+slug) {
|
||||
commune.style['display'] = "block";
|
||||
} else {
|
||||
commune.style['display'] = "none";
|
||||
}
|
||||
function displayCommune(select) {
|
||||
var $option = $(select).find(':selected');
|
||||
var url = $option.data('url');
|
||||
if (url) {
|
||||
window.location = url;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue