Commit d2273c97 authored by robin Tissot's avatar robin Tissot Committed by Robin

Hook the form to representative-list.

parent b7a0bd50
{% load i18n %} {% load i18n %}
<form class="form-horizontal"> <form class="form-horizontal" target="{% url "representative-list" %}">
<div class="input-group"> <div class="input-group">
<label class="sr-only" for="rechercher">{% trans "Search" %}</label> <label class="sr-only" for="rechercher">{% trans "Search" %}</label>
<input type="text" class="form-control" placeholder="{% trans "Search" %}" id="rechercher"> <input type="text" class="form-control" name="search" placeholder="{% trans "Search" %}" id="rechercher">
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-primary" type="button"> <button class="btn btn-primary" type="button">
<span class="glyphicon glyphicon-search"></span> <span class="glyphicon glyphicon-search"></span>
...@@ -12,99 +12,93 @@ ...@@ -12,99 +12,93 @@
</div> </div>
</form> </form>
<button class="btn btn-default" type="button" data-toggle="collapse" data-target="#moresearch" aria-expanded="false" aria-controls="moresearch"> <button class="btn btn-default" type="button" data-toggle="collapse" data-target="#formMEP" aria-expanded="false" aria-controls="formMEP">
{% trans "More search options" %} {% trans "More search options" %}
</button> </button>
<div class="collapse" id="moresearch"> <div class="collapse" id="formMEP">
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#formMEP" aria-expanded="false" aria-controls="formMEP"> <form id="search-form" class="form-horizontal">
{% trans "Find a MEP" %} <div class="form-group">
</button> <label class="col-sm-3" for="country">{% trans "Country" %}</label>
<div class="col-sm-9">
<div class="collapse" id="formMEP"> <select class="form-control" id="country">
<form class="form-horizontal"> <option>{% trans "All" %}</option>
<div class="form-group"> {% for country in countries %}
{# Note: could we not have only one form and get rid of this field ? #} <option value="{{ country.id }}" data-url="{% url "representative-list" group_kind="country" group=country.name %}">
<label class="col-sm-2" for="name">{% trans "Name" %}</label> {{ country.name }}
<div class="col-sm-10"> </option>
<input type="email" class="form-control" id="name" placeholder="{% trans "Leave empty for all" %}"> {% endfor %}
</div> </select>
</div> </div>
<div class="form-group"> </div>
<label class="col-sm-3" for="country">{% trans "Country" %}</label>
<div class="col-sm-9">
<select class="form-control" id="country">
<option>{% trans "All" %}</option>
{% for country in countries %}
<option value="{{ country.id }}">{{ country.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3" for="party">{% trans "Party" %}</label>
<div class="col-sm-9">
<select class="form-control" id="party">
<option>{% trans "All" %}</option>
{% for party in parties %}
<option value="{{ party.pk }}">{{ party.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3" for="delegation">Delegation</label> <label class="col-sm-3" for="party">{% trans "Party" %}</label>
<div class="col-sm-9"> <div class="col-sm-9">
<select class="form-control" id="delegation"> <select class="form-control" id="party">
<option>{% trans "All" %}</option> <option>{% trans "All" %}</option>
{% for delegation in delegations %} {% for party in parties %}
<option value="{{ delegation.pk }}">{{ delegation.name }}</option> <option value="{{ party.pk }}" data-url="{% url "representative-list" group_kind="group" group=party.name %}">
{% endfor %} {{ party.name }}
</select> </option>
</div> {% endfor %}
</div> </select>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3" for="committee">Committee</label> <label class="col-sm-3" for="delegation">Delegation</label>
<div class="col-sm-9"> <div class="col-sm-9">
<select class="form-control" id="committee"> <select class="form-control" id="delegation">
<option>{% trans "All" %}</option> <option>{% trans "All" %}</option>
{% for commitee in committees %} {% for delegation in delegations %}
<option value="{{ commitee.pk }}">{{ commitee.name }}</option> <option value="{{ delegation.pk }}" data-url="{% url "representative-list" group_kind="delegation" group=delegation.name %}">
{% endfor %} {{ delegation.name }}
</select> </option>
</div> {% endfor %}
</div> </select>
</div>
</div>
<button type="submit" class="btn btn-default">{% trans "Search" %}</button> <div class="form-group">
</form> <label class="col-sm-3" for="committee">Committee</label>
<div class="col-sm-9">
<select class="form-control" id="committee">
<option>{% trans "All" %}</option>
{% for commitee in committees %}
<option value="{{ commitee.pk }}" data-url="{% url "representative-list" group_kind="commitee" group=commitee.name %}">
{{ commitee.name }}
</option>
{% endfor %}
</select>
</div>
</div> </div>
{% comment %} {% comment %}<button type="submit" class="btn btn-default">{% trans "Search" %}</button>{% endcomment %}
<!-- i don't know what is this list supposed to contain since we already have a 2 click to dossier detail btn --> </form>
</div>
{% comment %}
<!-- i don't know what is this list supposed to contain since we already have a 2 click to dossier detail btn -->
<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#formDossiers" aria-expanded="false" aria-controls="formDossiers"> <button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#formDossiers" aria-expanded="false" aria-controls="formDossiers">
{% trans "Explore the dossiers" %} {% trans "Explore the dossiers" %}
</button> </button>
<div class="collapse" id="formDossiers"> <div class="collapse" id="formDossiers">
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-group"> <div class="form-group">
<div class="col-sm-12"> <div class="col-sm-12">
<select class="form-control" id="dossiers"> <select class="form-control" id="dossiers">
<option>All</option> <option>All</option>
<option>Personal data protection: processing of data for the purposes of prevention, investigation, detection or prosecution of criminal offences or execution of criminal penalties, and free movement of data </option> <option>Personal data protection: processing of data for the purposes of prevention, investigation, detection or prosecution of criminal offences or execution of criminal penalties, and free movement of data </option>
<option>ACTA </option> <option>ACTA </option>
<option>Personal data protection: processing and free movement of data </option> <option>Personal data protection: processing and free movement of data </option>
</select> </select>
</div> </div>
</div>
<button type="submit" class="btn btn-default">Search</button>
</form>
</div> </div>
{% endcomment %} <button type="submit" class="btn btn-default">Search</button>
</form>
</div> </div>
{% endcomment %}
<script>
$(function() {
// redirect to the url contained in data-url of the selected <option>
$('#search-form :input').change(function(event) {
var url = $(':selected', event.target).data('url')
if (url) window.location.href = url;
});
});
</script>
...@@ -68,11 +68,12 @@ ...@@ -68,11 +68,12 @@
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="./js/ie10-viewport-bug-workaround.js"></script> <script src="./js/ie10-viewport-bug-workaround.js"></script>
{% include '_base_search_form_script.html' %}
<script> <script>
$(function () { $(function () {
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
}) })
</script> </script>
</body> </body>
</html> </html>
...@@ -7,8 +7,9 @@ ...@@ -7,8 +7,9 @@
{% block container-class %}custom-listMEP{% endblock %} {% block container-class %}custom-listMEP{% endblock %}
{% block content %} {% block content %}
<h1 class="text-center">{% trans "Members of the European Parliement" %}</h1> <h1 class="text-center">{% trans "Members of the European Parliement" %}</h1>
<p class="lead text-center">{number} MEP from {country}, members of {party}, working in {delegation} and on {committee}.</p> <p class="lead text-center">
{{ paginator.count }} {% trans "MEP" %}{% if search.country %} {% trans "from" %} {{ search.country }}{% endif %}{% if search.group %}, {% trans "members of" %} {{ search.group }}{% endif %}{% if search.delegation %}, {% trans "working in" %} {{ search.delegation }}{% endif %}{% if search.commitee %}, {% trans "on" %} {{ search.commitee }}{% endif %}.
</p>
{% comment %} {% comment %}
<!-- TODO: layout & ordering --> <!-- TODO: layout & ordering -->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment