Commit 42dcf122 authored by Bastien Le Querrec's avatar Bastien Le Querrec
Browse files

add a fallback using iframe

parent eeb8e2b1
Pipeline #2789 passed with stage
in 48 seconds
......@@ -22,6 +22,7 @@ build:
- cp -L -r parlementaires.css parlementairesjs-${CI_COMMIT_SHORT_SHA}/
- cp -L -r parlementaires.js parlementairesjs-${CI_COMMIT_SHORT_SHA}/
- cp -L -r demo.html parlementairesjs-${CI_COMMIT_SHORT_SHA}/
- cp -L -r iframe.html parlementairesjs-${CI_COMMIT_SHORT_SHA}/
artifacts:
paths:
- parlementairesjs-${CI_COMMIT_SHORT_SHA}/
......
......@@ -6,6 +6,8 @@ Demo: https://parlementairesjs.laquadrature.net/demo.html
## Usage
### Javascript (recommended)
1. In the `<head>` section, you must include the script and its CSS:
```html
......@@ -30,7 +32,7 @@ You can download a copy of the `parlementaires.js` and `parlementaires.css` and
You must set at least the `dataset` and `datasetConfig` values. Change the `id-of-your-div` with the ID of your `<div>` you added in stage 2.
## Options
### Options
| Option | Mandatory? | Description | Default |
| ------------------ | ---------- | ----------------------------------------------------------------------------------------- | --------------------- |
......@@ -45,6 +47,22 @@ You must set at least the `dataset` and `datasetConfig` values. Change the `id-o
| `facebook` | false | Display Facebook link. | `true` |
| `download` | false | Display a link to download data as a CSV file. | `true` |
## Iframe (fallback)
If you are unable to add a script to your web page, you can fallback to the iframe method. Please note that you cannot have a custom CSS nor options by doing this. Datasets available are limited to those [listed bellow](#datasets-and-their-configuration).
Without a filter:
```html
<iframe src="https://parlementairesjs.laquadrature.net/iframe.html#dataset" frameborder="1" width="100%" height="640px">
```
With a filter:
```html
<iframe src="https://parlementairesjs.laquadrature.net/iframe.html#dataset-filter" frameborder="1" width="100%" height="640px">
```
## Generated HTML
The following HTML is generated:
......
......@@ -42,8 +42,9 @@
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.</p>
<p>Ut velit mauris, egestas sed, gravida nec, ornare ut, mi. Aenean ut orci vel massa suscipit pulvinar. Nulla sollicitudin. Fusce varius, ligula non tempus aliquam, nunc turpis ullamcorper nibh, in tempus sapien eros vitae ligula. Pellentesque rhoncus nunc et augue. Integer id felis. Curabitur aliquet pellentesque diam. Integer quis metus vitae elit lobortis egestas. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi vel erat non mauris convallis vehicula. Nulla et sapien. Integer tortor tellus, aliquam faucibus, convallis id, congue eu, quam. Mauris ullamcorper felis vitae erat. Proin feugiat, augue non elementum posuere, metus purus iaculis lectus, et tristique ligula justo vitae magna.</p>
<p>Aliquam convallis sollicitudin purus. Praesent aliquam, enim at fermentum mollis, ligula massa adipiscing nisl, ac euismod nibh nisl eu lectus. Fusce vulputate sem at sapien. Vivamus leo. Aliquam euismod libero eu enim. Nulla nec felis sed leo placerat imperdiet. Aenean suscipit nulla in justo. Suspendisse cursus rutrum augue. Nulla tincidunt tincidunt mi. Curabitur iaculis, lorem vel rhoncus faucibus, felis magna fermentum augue, et ultricies lacus lorem varius purus. Curabitur eu amet.</p>
<div id="parlementaires"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed non risus. Suspendisse lectus tortor, dignissim sit amet, adipiscing nec, ultricies sed, dolor. Cras elementum ultrices diam. Maecenas ligula massa, varius a, semper congue, euismod non, mi. Proin porttitor, orci nec nonummy molestie, enim est eleifend mi, non fermentum diam nisl sit amet erat. Duis semper. Duis arcu massa, scelerisque vitae, consequat in, pretium a, enim. Pellentesque congue. Ut in risus volutpat libero pharetra tempor. Cras vestibulum bibendum augue. Praesent egestas leo in pede. Praesent blandit odio eu enim. Pellentesque sed dui ut augue blandit sodales. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aliquam nibh. Mauris ac mauris sed pede pellentesque fermentum. Maecenas adipiscing ante non diam sodales hendrerit.</p>
<p><iframe src="iframe.html#senat-Lois" frameborder="1" width="100%" height="640px"></iframe></p>
</div>
<script type="text/javascript">
ParlementairesJS({
......
<!DOCTYPE html>
<html>
<head>
<title>ParlementairesJS</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script src="parlementaires.js"></script>
<link rel='stylesheet' href='parlementaires.css' type='text/css' media='all' />
<style>
html {
font-family: sans-serif;
}
body {
padding: 0;
margin: 0;
}
html, body, #map {
height: 100%;
width: 100%;
}
#parlementaires {
padding: 1em 3em 1em 3em;
}
</style>
</head>
<body>
<div id="parlementaires"></div>
<script type="text/javascript">
var hash = window.location.hash.substr(1);
if (!hash) throw new Error("Dataset is missing");
var dataset = hash.split('-')[0];
var filter = decodeURI(hash.split('-')[1]);
ParlementairesJS({
dataset: "/json/" + dataset + ".json",
datasetConfig: "/json/" + dataset + "-config.json",
commissionFilter: filter
}).display('parlementaires');
</script>
</body>
</html>
\ No newline at end of file
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