initial commit
|
1 |
html |
2 |
head |
|
3 |
link(rel='stylesheet', href="#{url}/stylesheets/select.css") |
|
4 |
link(rel='stylesheet', href="#{url}/stylesheets/button.css") |
|
5 |
body |
|
6 |
script(type='text/javascript'). |
|
7 |
var maprequest = {}; |
|
8 |
function set_visibility (select) { |
|
9 |
document.getElementById('election_to_compare').style.visibility = (select.value === 'Evolution avec autre scrutin') ? 'visible' : 'hidden' |
|
10 |
} |
|
11 |
function savechoice (select, item) { |
|
12 |
maprequest[item] = select.value; |
|
13 |
if ( |
|
14 |
maprequest.election && maprequest.section |
|
15 |
&& maprequest.election !== "0" && maprequest.section !== "0" |
|
16 |
&& ((maprequest.requete && maprequest.requete !== 'Requêtes' && maprequest.requete !== 'Evolution avec autre scrutin') || |
|
17 |
(maprequest.requete === 'Evolution avec autre scrutin' && maprequest.comparaison && maprequest.comparaison !== 0 |
|
18 |
&& maprequest.comparaison !== maprequest.election ) ) |
|
19 |
) { |
|
20 |
document.getElementById('gobutton').style.visibility = 'visible'; |
|
21 |
} |
|
22 |
else { |
|
23 |
document.getElementById('gobutton').style.visibility = 'hidden'; |
|
24 |
} |
|
25 |
} |
|
26 |
function showzemap () { |
|
27 |
var form = document.createElement("form"); |
|
28 |
form.setAttribute("method", "post"); |
|
29 |
form.setAttribute("action", "/cartes-elections"); |
|
30 |
for (var key in maprequest) { |
|
31 |
if(maprequest.hasOwnProperty(key)) { |
|
32 |
var hiddenField = document.createElement("input"); |
|
33 |
hiddenField.setAttribute("type", "hidden"); |
|
34 |
hiddenField.setAttribute("name", key); |
|
35 |
hiddenField.setAttribute("value", maprequest[key]); |
|
36 |
form.appendChild(hiddenField); |
|
37 |
} |
|
38 |
} |
|
39 |
document.body.appendChild(form); |
|
40 |
form.submit(); |
|
41 |
} |
|
42 |
#page-wrapper |
|
43 |
.row |
|
44 |
span(class="css3-metro-dropdown") |
|
45 |
select(name="selected_election" onchange="savechoice(this, 'election')") |
|
46 |
.form-control |
|
47 |
each election,i in elections |
|
48 |
option(value=i) #{election) |
|
49 |
br |
|
50 |
.row |
|
51 |
span(class="css3-metro-dropdown css3-metro-dropdown-color-ff2e12") |
|
52 |
select(name="selected_section" onchange="savechoice(this, 'section')") |
|
53 |
.form-control |
|
54 |
each section,i in sections |
|
55 |
option(value=i) #{section) |
|
56 |
br |
|
57 |
.row |
|
58 |
span(class="css3-metro-dropdown css3-metro-dropdown-color-ff2e12") |
|
59 |
select(name="selected_requete" onchange="set_visibility(this); savechoice(this, 'requete')") |
|
60 |
.form-control |
|
61 |
each requete,i in requetes |
|
62 |
option(value=i) #{i} |
|
63 |
.row(id="election_to_compare" style="visibility:hidden") |
|
64 |
br |
|
65 |
span(class="css3-metro-dropdown") |
|
66 |
select(name="selected_election_comparaison" onchange="savechoice(this, 'comparaison')") |
|
67 |
.form-control |
|
68 |
each election,i in elections |
|
69 |
option(value=i) #{election) |
|
70 |
br |
|
71 |
.row(id="gobutton" style="visibility:hidden") |
|
72 |
a.btn(href="javascript: showzemap()") Voir la carte |
|
73 |
|