diff options
Diffstat (limited to 'app/javascript/controllers/map_controller.js')
-rw-r--r-- | app/javascript/controllers/map_controller.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/javascript/controllers/map_controller.js b/app/javascript/controllers/map_controller.js index 005599e..57bafa5 100644 --- a/app/javascript/controllers/map_controller.js +++ b/app/javascript/controllers/map_controller.js @@ -18,6 +18,7 @@ import "leaflet-providers" import "leaflet.markercluster/dist/leaflet.markercluster.js" import 'leaflet-extra-markers' +import 'leaflet-easyprint' export default class extends Controller { static targets = [ "container" ] @@ -65,6 +66,15 @@ export default class extends Controller { L.DomEvent.on(window, 'hashchange', this.doSomethingCool); + /* Show a button to print the map */ + L.easyPrint({ + title: 'Print this map', + position: 'bottomright', + filename: `incommon-map-detail`, + exportOnly: true, + sizeModes: ['A4Portrait', 'A4Landscape'] + }).addTo(this.map); + // Allow calling the mapController from elsewhere. this.element[this.identifier] = this } |