Commit 62c828f1 authored by Bastien Le Querrec's avatar Bastien Le Querrec
Browse files

add the possibility to exclude a group

so we can hide far-right groups :)
parent bdc815bb
......@@ -46,6 +46,7 @@ You must set at least the `dataset` and `datasetConfig` values. Change the `id-o
| `twitter` | false | Display Twitter link. | `true` |
| `facebook` | false | Display Facebook link. | `true` |
| `download` | false | Display a link to download data as a CSV file. | `true` |
| `hiddenGroups` | false | Do not display MPs in on of the specified parliamentary group. | `[]` |
## Iframe (fallback)
......
......@@ -65,6 +65,7 @@
//twitter: false, // Show Twitter links (optional; default: true)
//facebook: false, // Show Facebook links (optional; default: true)
//download: false, // Show link to download data (optional; default: false)
hiddenGroups: ["Rassemblement National"] // Hide groups in the list (optional; default: [])
}).display('deputes');
</script>
</body>
......
......@@ -20,6 +20,7 @@ function display(targetId) {
// Initiate vars
var mps = [];
var groups = [];
var hiddenGroups = (!this.options.hiddenGroups) ? [] : this.options.hiddenGroups;
var counties = [];
var selected = [];
var group = 0;
......@@ -135,8 +136,14 @@ function display(targetId) {
// List available groups and counties
for (var i=0; i<mps.length; i++) {
if (mps[i].county && counties.indexOf(mps[i].county) == -1) counties.push(mps[i].county);
if (mps[i].group && groups.indexOf(mps[i].group) == -1) groups.push(mps[i].group);
if (mps[i].county &&
counties.indexOf(mps[i].county) == -1)
counties.push(mps[i].county);
if (mps[i].group &&
groups.indexOf(mps[i].group) == -1 &&
hiddenGroups.indexOf(mps[i].group) == -1) // Exclude hidden groups from the final list
groups.push(mps[i].group);
}
// Fill in group select
......
Supports Markdown
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