-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(button) : Conformité DSFR du widget d'un bouton d'export pour les…
… outils de calcul (#334) * Bouton Exporter ou Sauvegarder en DSFR * Menu des options * Ajout d'un container sur les widgets pour plugger le bouton * Ajout events sur les widgets
- Loading branch information
1 parent
5de4067
commit 91db51b
Showing
26 changed files
with
955 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
samples-src/pages/tests/Export/pages-ol-export-modules-dsfr-buttons.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
{{#extend "ol-sample-modules-dsfr-layout"}} | ||
|
||
{{#content "vendor"}} | ||
|
||
<link rel="stylesheet" href="{{ baseurl }}/dist/modules/GpfExtOlExport.css" /> | ||
<script src="{{ baseurl }}/dist/modules/GpfExtOlExport.js"></script> | ||
<link rel="stylesheet" href="{{ baseurl }}/dist/modules/GpfExtOlLayerSwitcher.css" /> | ||
<script src="{{ baseurl }}/dist/modules/GpfExtOlLayerSwitcher.js"></script> | ||
<link rel="stylesheet" href="{{ baseurl }}/dist/modules/GpfExtOlDrawing.css" /> | ||
<script src="{{ baseurl }}/dist/modules/GpfExtOlDrawing.js"></script> | ||
{{/content}} | ||
|
||
{{#content "head"}} | ||
<title>Sample openlayers</title> | ||
{{/content}} | ||
|
||
{{#content "style"}} | ||
<style> | ||
div#map { | ||
width: 100%; | ||
height: 100vh; | ||
} | ||
div[id^=GPlayerSwitcher-] { | ||
top: 80px; | ||
right: 8px; | ||
} | ||
</style> | ||
{{/content}} | ||
|
||
{{#content "body"}} | ||
<h2>Ajout du widget Export</h2> | ||
<!-- map --> | ||
<div id="map"></div> | ||
{{/content}} | ||
|
||
{{#content "js"}} | ||
<script type="text/javascript"> | ||
if (window.Gp) { | ||
// activation des loggers | ||
Gp.Logger.enableAll(); | ||
} | ||
var map; | ||
var exportRoute; | ||
var createMap = function() { | ||
// on cache l'image de chargement du Géoportail. | ||
document.getElementById('map').style.backgroundImage = 'none'; | ||
|
||
// Création de la map | ||
map = new ol.Map({ | ||
target : "map", | ||
layers : [ | ||
new ol.layer.Tile({ | ||
source: new ol.source.OSM(), | ||
opacity: 0.5 | ||
}) | ||
], | ||
view : new ol.View({ | ||
center : [288074.8449901076, 6247982.515792289], | ||
zoom : 18 | ||
}) | ||
}); | ||
|
||
// Ajout du widget LayerSwitcher | ||
var layerSwitcher = new ol.control.LayerSwitcher({ | ||
options : { | ||
position : "top-right", | ||
collapsed : true, | ||
panel : true, | ||
counter : true | ||
} | ||
}); | ||
map.addControl(layerSwitcher); | ||
|
||
// cas drawing : | ||
// * bouton secondary avec icone | ||
// * mode sauvegarde | ||
// * sans menu | ||
// * target interne | ||
// * appel instance externe | ||
var drawing = new ol.control.Drawing({ | ||
position: "bottom-left", | ||
tools : { | ||
export : false | ||
} | ||
}); | ||
map.addControl(drawing); | ||
|
||
var exportDrawingExport = new ol.control.Export({ | ||
title : "Exporter", | ||
download : true, | ||
control: drawing, | ||
format : "kml", | ||
menu : false, | ||
icons : { | ||
button : "export" | ||
}, | ||
kind : "secondary" | ||
}); | ||
map.addControl(exportDrawingExport); | ||
exportDrawingExport.on("button:clicked", (e) => { | ||
console.log("Export Drawing", e); | ||
}); | ||
var exportDrawingSave = new ol.control.Export({ | ||
title : "Sauvegarder", | ||
download : false, | ||
control: drawing, | ||
format : "kml", | ||
icons : { | ||
button : "save" | ||
}, | ||
kind : "secondary" | ||
}); | ||
map.addControl(exportDrawingSave); | ||
exportDrawingSave.on("button:clicked", (e) => { | ||
console.log("Save Drawing", e); | ||
}); | ||
|
||
}; | ||
Gp.Services.getConfig({ | ||
customConfigFile : "{{ configurl }}", | ||
callbackSuffix : "", | ||
// apiKey: "{{ apikey }}", | ||
timeOut : 20000, | ||
onSuccess : createMap, | ||
onFailure : (e) => { | ||
console.error(e); | ||
} | ||
}); | ||
</script> | ||
{{/content}} | ||
{{/extend}} |
Oops, something went wrong.